當前位置: 首頁>>代碼示例>>Python>>正文


Python interfaces.IClient類代碼示例

本文整理匯總了Python中bika.lims.interfaces.IClient的典型用法代碼示例。如果您正苦於以下問題:Python IClient類的具體用法?Python IClient怎麽用?Python IClient使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了IClient類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Vocabulary_SampleType

 def Vocabulary_SampleType(self):
     vocabulary = CatalogVocabulary(self)
     vocabulary.catalog = 'bika_setup_catalog'
     folders = [self.bika_setup.bika_sampletypes]
     if IClient.providedBy(self.aq_parent):
         folders.append(self.aq_parent)
     return vocabulary(allow_blank=True, portal_type='SampleType')
開發者ID:kibreabg,項目名稱:Bika-LIMS,代碼行數:7,代碼來源:arimport.py

示例2: update

    def update(self):
        """Called before the listings renders
        """
        super(PatientsView, self).update()

        # Render the Add button. We need to do this here because patients live
        # inside site.patients folder
        self.context_actions = {}
        patients = api.get_portal().patients
        if security.check_permission(AddPatient, patients):
            self.context_actions = {
                _("Add"): {
                    "url": "createObject?type_name=Patient",
                    "icon": "++resource++bika.lims.images/add.png"}
            }

        # If the current user is a client contact, display those patients that
        # belong to same client or that do not belong to any client
        client = api.get_current_client()
        if client:
            query = dict(client_uid=[api.get_uid(client), "-1"])
            # We add UID "-1" to also include Patients w/o Client assigned
            self.contentFilter.update(query)
            for rv in self.review_states:
                rv["contentFilter"].update(query)

        # If the current context is a Client, remove the title column
        if IClient.providedBy(self.context):
            self.remove_column('getPrimaryReferrerTitle')
開發者ID:naralabs,項目名稱:bika.health,代碼行數:29,代碼來源:folder_view.py

示例3: folderitems

    def folderitems(self, **kwargs):
        items = super(ARImportsView, self).folderitems()
        for x in range(len(items)):
            if 'obj' not in items[x]:
                continue
            obj = items[x]['obj']
            items[x]['Title'] = obj.title_or_id()
            if items[x]['review_state'] == 'invalid':
                items[x]['replace']['Title'] = "<a href='%s/edit'>%s</a>" % (
                    obj.absolute_url(), items[x]['Title'])
            else:
                items[x]['replace']['Title'] = "<a href='%s/view'>%s</a>" % (
                    obj.absolute_url(), items[x]['Title'])
            items[x]['Creator'] = obj.Creator()
            items[x]['Filename'] = obj.getFilename()
            parent = obj.aq_parent
            items[x]['Client'] = parent if IClient.providedBy(parent) else ''
            items[x]['replace']['Client'] = "<a href='%s'>%s</a>" % (
                parent.absolute_url(), parent.Title())
            items[x]['DateCreated'] = ulocalized_time(
                obj.created(), long_format=True, time_only=False, context=obj)
            date = getTransitionDate(obj, 'validate')
            items[x]['DateValidated'] = date if date else ''
            date = getTransitionDate(obj, 'import')
            items[x]['DateImported'] = date if date else ''

        return items
開發者ID:fqblab,項目名稱:bika.lims,代碼行數:27,代碼來源:arimports.py

示例4: get_client_uid

 def get_client_uid(self):
     instance = self.context.aq_parent
     while not IPloneSiteRoot.providedBy(instance):
         if IClient.providedBy(instance):
             return instance.UID()
         if IBatch.providedBy(instance):
             client = instance.getClient()
             if client:
                 return client.UID()
開發者ID:fqblab,項目名稱:bika.lims,代碼行數:9,代碼來源:__init__.py

示例5: getClient

 def getClient(self):
     """ Retrieves the Client for which the current Batch is attached to
         Tries to retrieve the Client from the Schema property, but if not
         found, searches for linked ARs and retrieve the Client from the
         first one. If the Batch has no client, returns None.
     """
     client = self.Schema().getField('Client').get(self)
     if client:
         return client
     client = self.aq_parent
     if IClient.providedBy(client):
         return client
開發者ID:henriquechehad,項目名稱:Bika-LIMS,代碼行數:12,代碼來源:batch.py

示例6: __call__

 def __call__(self):
     plone.protect.CheckAuthenticator(self.request)
     curr_user = api.get_current_user()
     contact = api.get_user_contact(curr_user, contact_types=['Contact'])
     parent = contact and contact.getParent() or None
     if parent and not IClient.providedBy(parent):
         parent = None
     ret = {'ClientTitle': parent and parent.Title() or '',
            'ClientID': parent and parent.getClientID() or '',
            'ClientSysID': parent and parent.id or '',
            'ClientUID': parent and parent.UID() or '',}
     return json.dumps(ret)
開發者ID:naralabs,項目名稱:bika.health,代碼行數:12,代碼來源:client.py

示例7: __call__

    def __call__(self, context, mode, field, default):
        state = default if default else 'hidden'
        fieldName = field.getName()
        if fieldName != 'Client':
            return state
        parent = self.context.aq_parent

        if IBatch.providedBy(parent):
            if parent.getClient():
                return 'hidden'

        if IClient.providedBy(parent):
            return 'hidden'

        return state
開發者ID:Ammy2,項目名稱:Bika-LIMS,代碼行數:15,代碼來源:widgetvisibility.py

示例8: get_client

 def get_client(self, schema, fieldnames):
     """All Client Contact fields must be restricted to show only relevant
     Contacts.  During creation the batch can be in some weird states
     and is located inside some odd contexs (TempFolder, PortalFactory),
     so some wiggling required.  We also can't use schema field accessors
     directly, as it causes recursion.
     """
     client = None
     # If heirarchy does not exist we're in early creation; skip body.
     if hasattr(self, 'context') and hasattr(self.context, 'aq_parent'):
         parent = self.context.aq_parent
         while not IPloneSiteRoot.providedBy(parent):
             if IClient.providedBy(parent):
                 client = parent
                 break
             parent = parent.aq_parent
     return client
開發者ID:rockfruit,項目名稱:bika.uw,代碼行數:17,代碼來源:batch.py

示例9: get_current_client

    def get_current_client(self, default=None):
        """Returns the client the current user belongs to
        """
        user = api.get_current_user()
        roles = user.getRoles()
        if 'Client' not in roles:
            return default

        contact = api.get_user_contact(user)
        if not contact or ILabContact.providedBy(contact):
            return default

        client = api.get_parent(contact)
        if not client or not IClient.providedBy(client):
            return default

        return client
開發者ID:naralabs,項目名稱:bika.health,代碼行數:17,代碼來源:getdoctors.py

示例10: __call__

    def __call__(self):
        mtool = getToolByName(self.context, 'portal_membership')
        can_add_doctors = mtool.checkPermission(AddDoctor, self.context)
        if can_add_doctors:
            add_doctors_url = '{}/doctors/createObject?type_name=Doctor' \
                .format(self.portal_url)
            self.context_actions[_('Add')] = {
                'url': add_doctors_url,
                'icon': '++resource++bika.lims.images/add.png'
            }
        if mtool.checkPermission(ManageDoctors, self.context):
            self.review_states[0]['transitions'].append({'id':'deactivate'})
            self.review_states.append(
                {'id':'inactive',
                 'title': _('Dormant'),
                 'contentFilter': {'is_active': False},
                 'transitions': [{'id':'activate'}, ],
                 'columns': self.columns.keys()})
            self.review_states.append(
                {'id':'all',
                 'title': _('All'),
                 'contentFilter':{},
                 'transitions':[{'id':'empty'}],
                 'columns': self.columns.keys()})
            stat = self.request.get("%s_review_state"%self.form_id, 'default')
            self.show_select_column = stat != 'all'

        # If the current context is a Client, filter Doctors by Client UID
        if IClient.providedBy(self.context):
            client_uid = api.get_uid(self.context)
            self.contentFilter['getPrimaryReferrerUID'] = client_uid

        # If the current user is a client contact, do not display the doctors
        # assigned to other clients
        elif self.get_user_client_uid():
            client_uid = self.get_user_client_uid()
            self.contentFilter['getPrimaryReferrerUID'] = [client_uid, None]

        return super(DoctorsView, self).__call__()
開發者ID:naralabs,項目名稱:bika.health,代碼行數:39,代碼來源:folder_view.py

示例11: __init__

    def __init__(self, context, request):
        super(ARImportsView, self).__init__(context, request)
        request.set('disable_plone.rightcolumn', 1)
        alsoProvides(request, IContentListing)

        self.catalog = "portal_catalog"
        self.contentFilter = {
            'portal_type': 'ARImport',
            'cancellation_state': 'active',
            'sort_on': 'sortable_title',
        }
        self.context_actions = {}
        if IClient.providedBy(self.context):
            self.context_actions = {
                _('AR Import'): {
                    'url': 'arimport_add',
                    'icon': '++resource++bika.lims.images/add.png'}}
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = False
        self.pagesize = 50
        self.form_id = "arimports"

        self.icon = \
            self.portal_url + "/++resource++bika.lims.images/arimport_big.png"
        self.title = self.context.translate(_("Analysis Request Imports"))
        self.description = ""

        self.columns = {
            'Title': {'title': _('Title')},
            'Client': {'title': _('Client')},
            'Filename': {'title': _('Filename')},
            'Creator': {'title': _('Date Created')},
            'DateCreated': {'title': _('Date Created')},
            'DateValidated': {'title': _('Date Validated')},
            'DateImported': {'title': _('Date Imported')},
            'state_title': {'title': _('State')},
        }
        self.review_states = [
            {'id': 'default',
             'title': _('Pending'),
             'contentFilter': {'review_state': ['invalid', 'valid']},
             'columns': ['Title',
                         'Creator',
                         'Filename',
                         'Client',
                         'DateCreated',
                         'DateValidated',
                         'DateImported',
                         'state_title']},
            {'id': 'imported',
             'title': _('Imported'),
             'contentFilter': {'review_state': 'imported'},
             'columns': ['Title',
                         'Creator',
                         'Filename',
                         'Client',
                         'DateCreated',
                         'DateValidated',
                         'DateImported',
                         'state_title']},
            {'id': 'cancelled',
             'title': _('Cancelled'),
             'contentFilter': {
                 'review_state': ['initial', 'invalid', 'valid', 'imported'],
                 'cancellation_state': 'cancelled'
             },
             'columns': ['Title',
                         'Creator',
                         'Filename',
                         'Client',
                         'DateCreated',
                         'DateValidated',
                         'DateImported',
                         'state_title']},
        ]
開發者ID:fqblab,項目名稱:bika.lims,代碼行數:76,代碼來源:arimports.py

示例12: __init__

    def __init__(self, context, request):
        super(BaseARImportsView, self).__init__(context, request)
        request.set('disable_plone.rightcolumn', 1)

        self.catalog = "portal_catalog"
        self.contentFilter = {
                'portal_type': 'ARImport',
                'sort_on':'sortable_title',
                }
        self.context_actions = {}
        if IClient.providedBy(self.context):
            self.context_actions = \
                {_('AR Import'):
                           {'url': 'arimport_add',
                            'icon': '++resource++bika.lims.images/add.png'}}
        self.show_sort_column = False
        self.show_select_row = False
        self.show_select_column = False
        self.pagesize = 50
        self.form_id = "arimports"

        self.icon = \
            self.portal_url + "/++resource++bika.lims.images/arimport_big.png"
        self.title = self.context.translate(_("Analysis Request Imports"))
        self.description = ""


        self.columns = {
            'title': {'title': _('Import')},
            'getClientTitle': {'title': _('Client')},
            'getDateImported': {'title': _('Date Imported')},
            'getStatus': {'title': _('Validity')},
            'getDateApplied': {'title': _('Date Submitted')},
            'state_title': {'title': _('State')},
        }
        self.review_states = [
            {'id':'default',
             'title': _('All'),
             'contentFilter':{},
             'columns': ['title',
                         'getClientTitle',
                         'getDateImported',
                         'getStatus',
                         'getDateApplied',
                         'state_title']},
            {'id':'imported',
             'title': _('Imported'),
             'contentFilter':{'review_state':'imported'},
             'columns': ['title',
                         'getClientTitle',
                         'getDateImported',
                         'getStatus']},
            {'id':'submitted',
             'title': _('Applied'),
             'contentFilter':{'review_state':'submitted'},
             'columns': ['title',
                         'getClientTitle',
                         'getDateImported',
                         'getStatus',
                         'getDateApplied']},
        ]
開發者ID:ChamaraPhilipsuom,項目名稱:Bika-LIMS,代碼行數:61,代碼來源:arimports.py

示例13: filter_client_lookups

 def filter_client_lookups(self, schema, client):
     if IClient.providedBy(client):
         ids = [c.getId() for c in client.objectValues('Contact')]
         for fn in ["Contact", "CCContact", "InvoiceContact"]:
             if fn in schema:
                 schema[fn].widget.base_query['id'] = ids
開發者ID:rockfruit,項目名稱:bika.uw,代碼行數:6,代碼來源:batch.py

示例14: is_client_context

 def is_client_context(self):
     """Returns whether the batch listing is displayed in IClient context
     or if the current user is a client contact
     """
     return api.get_current_client() or IClient.providedBy(self.context)
開發者ID:naralabs,項目名稱:bika.health,代碼行數:5,代碼來源:batchfolder.py


注:本文中的bika.lims.interfaces.IClient類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。