def folderitem(self, obj, item, index): """Service triggered each time an item is iterated in folderitems. The use of this service prevents the extra-loops in child objects. :obj: the instance of the class to be foldered :item: dict containing the properties of the object to be used by the template :index: current index of the item """ item["Description"] = obj.Description() item["replace"]["Title"] = get_link(item["url"], item["Title"]) instrument = obj.getInstrument() if instrument: instrument_url = api.get_url(instrument) instrument_title = api.get_title(instrument) item["Instrument"] = instrument_title item["replace"]["Instrument"] = get_link( instrument_url, value=instrument_title) # Method method_uid = obj.getMethodUID() if method_uid: method = api.get_object_by_uid(method_uid) method_url = api.get_url(method) method_title = api.get_title(method) item["Method"] = method_title item["replace"]["Method"] = get_link( method_url, value=method_title) return item
def folder_item(self, obj, item, index): batch = api.get_object(obj) # Doctor doctor = get_field_value(batch, "Doctor", None) item["Doctor"] = doctor and doctor.Title() or "" item["replace"]["Doctor"] = doctor and get_link(api.get_url(doctor), doctor.Title()) # Onset Date onset = get_field_value(batch, "OnsetDate", None) item["OnsetDate"] = onset and self.listing.ulocalized_time(onset) or "" # Patient item["Patient"] = "" item["getPatientID"] = "" item["getClientPatientID"] = "" patient = get_field_value(batch, "Patient", None) if patient: url = api.get_url(patient) item["Patient"] = patient.Title() item["replace"]["Patient"] = get_link(url, patient.Title()) item["getPatientID"] = patient.id item["replace"]["getPatientID"] = get_link(url, patient.id) pid = patient.getClientPatientID() pid_link = pid and get_link(url, pid) or "" item["getClientPatientID"] = pid or "" item["replace"]["getClientPatientID"] = pid_link return item
def folderitem(self, obj, item, index): item = super(InstrumentReferenceAnalysesView, self).folderitem(obj, item, index) analysis = api.get_object(obj) # Partition is used to group/toggle QC Analyses sample = analysis.getSample() item["replace"]["Partition"] = get_link(api.get_url(sample), api.get_id(sample)) # Get retractions field item["Retractions"] = "" report = analysis.getRetractedAnalysesPdfReport() if report: url = api.get_url(analysis) href = "{}/at_download/RetractedAnalysesPdfReport".format(url) attrs = {"class": "pdf", "target": "_blank"} title = _("Retractions") link = get_link(href, title, **attrs) item["Retractions"] = title item["replace"]["Retractions"] = link # Add the analysis to the QC Chart self.chart.add_analysis(analysis) return item
def __call__(self): super(AddAnalysesView, self).__call__() # TODO: Refactor Worfklow grant = self.is_edit_allowed() and self.is_manage_allowed() if not grant: redirect_url = api.get_url(self.context) return self.request.response.redirect(redirect_url) # TODO: Refactor this function call showRejectionMessage(self.context) # Handle form submission if self.request.form.get("submitted"): CheckAuthenticator(self.request) success = self.handle_submit() if success: self.add_status_message(_("Changes saved.")) redirect_url = "{}/{}".format(api.get_url(self.context), "manage_results") self.request.response.redirect(redirect_url) else: self.add_status_message( _("No analyses were added to this worksheet."), level="warning") return self.template() # handle subpath calls if len(self.traverse_subpath) > 0: return self.handle_subpath() return self.template()
def folderitem(self, obj, item, index): item = super(QCAnalysesView, self).folderitem(obj, item, index) obj = self.get_object(obj) # Fill Worksheet cell worksheet = obj.getWorksheet() if not worksheet: return item # Fill the Worksheet cell ws_id = api.get_id(worksheet) ws_url = api.get_url(worksheet) item["replace"]["Worksheet"] = get_link(ws_url, value=ws_id) if IDuplicateAnalysis.providedBy(obj): an_type = "d" img_name = "duplicate.png" parent = obj.getRequest() else: an_type = obj.getReferenceType() img_name = an_type == "c" and "control.png" or "blank.png" parent = obj.aq_parent # Render the image an_type = QCANALYSIS_TYPES.getValue(an_type) item['before']['Service'] = get_image(img_name, title=an_type) # Fill the Parent cell parent_url = api.get_url(parent) parent_id = api.get_id(parent) item["replace"]["Parent"] = get_link(parent_url, value=parent_id) return item
def folderitem(self, obj, item, index): """Applies new properties to the item to be rendered """ obj = api.get_object(obj) # Replace client name with the link item['getPrimaryReferrer'] = "" client = obj.getClient() if client: client_link = get_link(api.get_url(client), api.get_title(client)) item["replace"]["getPrimaryReferrer"] = client_link # Replace doctor's full name with a link fullname = obj.getFullname() doctor_url = "{}/analysisrequests".format(api.get_url(obj)) doctor_link = get_link(doctor_url, fullname) item["replace"]["getFullname"] = doctor_link doctor_link = get_link(doctor_url, obj.getDoctorID()) item["replace"]["getDoctorID"] = doctor_link # Replace doctor's full name with a link email = obj.getEmailAddress() if email: item["replace"]['getEmailAddress'] = get_email_link(email) # Display the internal/external icons, but only if the logged-in user # does not belong to an external client if not self.is_external_user(): item["before"]["getFullname"] = get_client_aware_html_image(obj) return item
def folder_item(self, obj, item, index): batch = api.get_object(obj) # Doctor doctor = get_field_value(batch, "Doctor", None) item["Doctor"] = doctor and doctor.Title() or "" item["replace"]["Doctor"] = doctor and get_link( api.get_url(doctor), doctor.Title()) # Onset Date onset = get_field_value(batch, "OnsetDate", None) item["OnsetDate"] = onset and self.listing.ulocalized_time(onset) or "" # Patient item["Patient"] = "" item["getPatientID"] = "" item["getClientPatientID"] = "" patient = get_field_value(batch, "Patient", None) if patient: url = api.get_url(patient) item["Patient"] = patient.Title() item["replace"]["Patient"] = get_link(url, patient.Title()) item["getPatientID"] = patient.id item["replace"]["getPatientID"] = get_link(url, patient.id) pid = patient.getClientPatientID() pid_link = pid and get_link(url, pid) or "" item["getClientPatientID"] = pid or "" item["replace"]["getClientPatientID"] = pid_link return item
def __call__(self): url = api.get_url(api.get_portal()) current_user = api.get_current_user() contact = api.get_user_contact(current_user) if contact: parent = api.get_parent(contact) url = api.get_url(parent) return self.request.response.redirect(url)
def folderitem(self, obj, item, idx): """ Replace or add the required/wanted fields for each invoice in the item dictionary :param obj: the instance of the class to be foldered. In our case, an Invoice :param item: dict containing the properties of the object to be used by the template :return: dictionary with the updated fields of the invoice being processed """ currency = currency_format(self.context, 'en') item['replace']['id'] = get_link(api.get_url(obj), obj.getId()) client = obj.getClient() if client: item['client'] = client.Title() item['replace']['client'] = get_link(client.absolute_url(), item['client']) item['email'] = client.getEmailAddress() item['replace']['email'] = get_email_link(client.getEmailAddress()) item['phone'] = client.getPhone() else: item['client'] = '' item['email'] = '' item['phone'] = '' item['invoicedate'] = self.ulocalized_time(obj.getInvoiceDate()) item['startdate'] = self.ulocalized_time(obj.getBatchStartDate()) item['enddate'] = self.ulocalized_time(obj.getBatchEndDate()) item['subtotal'] = currency(obj.getSubtotal()) item['vatamount'] = currency(obj.getVATAmount()) item['total'] = currency(obj.getTotal()) return item
def folderitem(self, obj, item, index): obj = api.get_object(obj) url = api.get_url(obj) # MRN mrn = obj.get_mrn().encode("utf8") item["mrn"] = mrn item["replace"]["mrn"] = get_link(url, value=mrn) # Patient ID patient_id = obj.get_patient_id().encode("utf8") item["patient_id"] = patient_id if patient_id: item["replace"]["patient_id"] = get_link(url, value=patient_id) # Fullname fullname = obj.get_fullname().encode("utf8") item["fullname"] = fullname if fullname: item["replace"]["fullname"] = get_link(url, value=fullname) # Email email = obj.get_email() item["email"] = email if email: item["replace"]["email"] = get_email_link(email, value=email) # Gender item["gender"] = obj.get_gender() # Birthdate birthdate = obj.get_birthdate() item["birthdate"] = self.ulocalized_time(birthdate, long_format=0) return item
def get_task_url(task): """Returns the canonical url of the task """ return "/".join([ capi.get_url(capi.get_portal()), "@@API/senaite/v1/queue_server", task.task_uid ])
def folderitem(self, obj, item, index): obj = api.get_object(obj) url = api.get_url(obj) title = api.get_title(obj) item["replace"]["Title"] = get_link(url, value=title) item["query_type"] = getattr(obj, "query_type", None) return item
def update(self): """Before template render hook """ super(BatchFolderContentsView, self).update() if self.context.portal_type == "BatchFolder": self.request.set("disable_border", 1) # By default, only users with AddBatch permissions for the current # context can add batches. self.context_actions = { _("Add"): { "url": "createObject?type_name=Batch", "permission": AddBatch, "icon": "++resource++bika.lims.images/add.png" } } # If current user is a client contact and current context is not a # Client, then modify the url for Add action so the Batch gets created # inside the Client object to which the current user belongs. The # reason is that Client contacts do not have privileges to create # Batches inside portal/batches if not IClient.providedBy(self.context): # Get the client the current user belongs to client = api.get_current_client() if client and check_permission(AddBatch, client): add_url = self.context_actions[_("Add")]["url"] add_url = "{}/{}".format(api.get_url(client), add_url) self.context_actions[_("Add")]["url"] = add_url del (self.context_actions[_("Add")]["permission"])
def before_render(self): """Called before the listing renders """ super(DoctorBatchListingViewAdapter, self).before_render() # Remove unnecessary columns hide = [ "Doctor", ] self.hide_columns(hide) # Filter by doctor query = dict(getDoctorUID=api.get_uid(self.context)) self.listing.contentFilter.update(query) for rv in self.listing.review_states: if "contentFilter" not in rv: rv["contentFilter"] = {} rv["contentFilter"].update(query) url = api.get_url(self.context) self.listing.context_actions = { _("Add"): { "url": "{}/createObject?type_name=Batch".format(url), "permission": AddBatch, "icon": "++resource++bika.lims.images/add.png" } }
def get_sample_container_info(self): """Returns the storage container this Sample is stored in """ # Search the container the sample is stored in query = { "portal_type": "StorageSamplesContainer", "get_samples_uids": api.get_uid(self.context) } brains = api.search(query, SENAITE_STORAGE_CATALOG) if not brains: return None # Get the data info from the container container = api.get_object(brains[0]) position = container.get_object_position(self.context) position = container.position_to_alpha(position[0], position[1]) return { "uid": api.get_uid(container), "id": api.get_id(container), "title": api.get_title(container), "url": api.get_url(container), "position": position, "full_title": container.get_full_title(), "when": wf.getTransitionDate(self.context, "store"), }
def update(self): """Before template render hook """ super(DoctorsView, self).update() if IDoctors.providedBy(self.context): # Top-level doctors listing self.request.set("disable_border", 1) elif "disable_border" in self.request: del (self.request["disable_border"]) # By default, only users with AddDoctor permissions for the current # context can add doctors. self.context_actions = { _("Add"): { "url": "createObject?type_name=Doctor", "permission": AddDoctor, "icon": "++resource++bika.lims.images/add.png" } } # If current user is a client contact and current context is not a # Client, then modify the url for Add action so the Doctor gets created # inside the Client object the current user belongs to client = self.get_user_client() if client and check_permission(AddDoctor, client): add_url = self.context_actions[_("Add")]["url"] add_url = "{}/{}".format(api.get_url(client), add_url) self.context_actions[_("Add")]["url"] = add_url del (self.context_actions[_("Add")]["permission"]) if self.get_client(): # The current context is a Client, remove the client column self.remove_column('getPrimaryReferrer')
def before_render(self): # Additional columns self.add_columns() # Remove unnecessary columns self.hide_columns() # Apply client filter, if necessary client = api.get_current_client() if client: query = dict(getClientUID=api.get_uid(client)) self.listing.contentFilter.update(query) for rv in self.listing.review_states: if "contentFilter" not in rv: rv["contentFilter"] = {} rv["contentFilter"].update(query) # Render the Add button self.listing.context_actions = {} batches = api.get_portal().batches if security.check_permission(AddBatch, batches): url = api.get_url(batches) self.listing.context_actions = { _("Add"): { "url": "{}/createObject?type_name=Batch".format(url), "icon": "++resource++bika.lims.images/add.png"} }
def folderitem(self, obj, item, index): # Date of Birth dob = obj.getBirthDate item['getBirthDate'] = dob and self.ulocalized_time(dob) or "" try: item["age"] = dob and get_age_ymd(dob) or "" except: # Wrong date?? msg = _("Date of Birth might be wrong") img = get_image("exclamation.png", title=msg) item["replace"]["age"] = img # make the columns patient title, patient ID and client patient ID # redirect to the Analysis Requests of the patient ars_url = "{}/{}".format(api.get_url(obj), "analysisrequests") for column in ['Title', 'getPatientID', 'getClientPatientID']: value = getattr(obj, column, None) if value: item["replace"][column] = get_link(ars_url, value) # Display the internal/external icons, but only if the logged-in user # does not belong to an external client if not self.is_external_user(): # Renders an icon (shared/private/warn) next to the title of the # item based on the client item["before"]["Title"] = get_client_aware_html_image(obj) return item
def folderitem(self, obj, item, index): """Service triggered each time an item is iterated in folderitems. The use of this service prevents the extra-loops in child objects. :obj: the instance of the class to be foldered :item: dict containing the properties of the object to be used by the template :index: current index of the item """ item = super(ReferenceSamplesView, self).folderitem(obj, item, index) # ensure we have an object and not a brain obj = api.get_object(obj) url = api.get_url(obj) title = api.get_title(obj) item["Title"] = title item["replace"]["Title"] = get_link(url, value=title) item["allow_edit"] = self.get_editable_columns() # Supported Services supported_services_choices = self.make_supported_services_choices(obj) item["choices"]["SupportedServices"] = supported_services_choices # Position item["Position"] = "new" item["choices"]["Position"] = self.make_position_choices() return item
def before_render(self): # Additional columns self.add_columns() # Remove unnecessary columns self.hide_columns() # Apply client filter, if necessary client = api.get_current_client() if client: query = dict(getClientUID=api.get_uid(client)) self.listing.contentFilter.update(query) for rv in self.listing.review_states: if "contentFilter" not in rv: rv["contentFilter"] = {} rv["contentFilter"].update(query) # Render the Add button self.listing.context_actions = {} batches = api.get_portal().batches if security.check_permission(AddBatch, batches): url = api.get_url(batches) self.listing.context_actions = { _("Add"): { "url": "{}/createObject?type_name=Batch".format(url), "icon": "++resource++bika.lims.images/add.png" } }
def redirect(self, message=None, level="info"): """Redirect with a message """ redirect_url = api.get_url(self.context) if message is not None: self.context.plone_utils.addPortalMessage(message, level) return self.request.response.redirect(redirect_url)
def folderitem(self, obj, item, index): """Service triggered each time an item is iterated in folderitems. The use of this service prevents the extra-loops in child objects. :obj: the instance of the class to be foldered :item: dict containing the properties of the object to be used by the template :index: current index of the item """ title = obj.Title() url = obj.absolute_url() item["replace"]["Title"] = get_link(url, value=title) sampletype = obj.getSampleType() if sampletype: title = sampletype.Title() url = sampletype.absolute_url() item["replace"]["SampleType"] = get_link(url, value=title) dynamic_spec = obj.getDynamicAnalysisSpec() if dynamic_spec: title = dynamic_spec.Title() url = api.get_url(dynamic_spec) item["replace"]["DynamicSpec"] = get_link(url, value=title) return item
def __call__(self): # TODO: Refactor Worfklow if not self.is_edit_allowed(): redirect_url = api.get_url(self.context) return self.request.response.redirect(redirect_url) # TODO: Refactor this function call showRejectionMessage(self.context) # Save the results layout rlayout = self.request.get("resultslayout", "") if rlayout and rlayout in WORKSHEET_LAYOUT_OPTIONS.keys() \ and rlayout != self.context.getResultsLayout(): self.context.setResultsLayout(rlayout) message = _("Changes saved.") self.context.plone_utils.addPortalMessage(message, "info") # Classic/Transposed View Switch if self.context.getResultsLayout() == "1": view = "analyses_classic_view" self.Analyses = api.get_view(view, context=self.context, request=self.request) else: view = "analyses_transposed_view" self.Analyses = api.get_view(view, context=self.context, request=self.request) self.analystname = self.context.getAnalystName() self.instrumenttitle = self.get_instrument_title() # Check if the instruments used are valid self.checkInstrumentsValidity() return self.template()
def folderitem(self, obj, item, index): """Service triggered each time an item is iterated in folderitems. The use of this service prevents the extra-loops in child objects. :obj: the instance of the class to be foldered :item: dict containing the properties of the object to be used by the template :index: current index of the item """ layout = obj.getLayout title = api.get_title(obj) url = api.get_url(obj) item["CreationDate"] = self.ulocalized_time(obj.created) if len(obj.getAnalysesUIDs) == 0: item["table_row_class"] = "state-empty-worksheet" title_link = "{}/{}".format(url, "add_analyses") if len(layout) > 0: title_link = "{}/{}".format(url, "manage_results") item["Title"] = title item["replace"]["Title"] = get_link(title_link, value=title) pos_parent = {} for slot in layout: # compensate for bad data caused by a stupid bug. if type(slot["position"]) in (list, tuple): slot["position"] = slot["position"][0] if slot["position"] == "new": continue if slot["position"] in pos_parent: continue pos_parent[slot["position"]] =\ self.rc.lookupObject(slot.get("container_uid")) # Total QC Analyses item["NumQCAnalyses"] = str(obj.getNumberOfQCAnalyses) # Total Routine Analyses item["NumRegularAnalyses"] = str(obj.getNumberOfRegularAnalyses) # Total Number of Samples item["NumRegularSamples"] = str(obj.getNumberOfRegularSamples) # Progress progress_perc = obj.getProgressPercentage item["replace"]["Progress"] = get_progress_bar_html(progress_perc) review_state = item["review_state"] if self.can_reassign and review_state == "open": item["Analyst"] = obj.getAnalyst item["allow_edit"] = ["Analyst"] item["required"] = ["Analyst"] item["choices"] = {"Analyst": self.analyst_choices} else: fullname = user_fullname(self.context, obj.getAnalyst) item["Analyst"] = fullname return item
def folder_item(self, obj, item, index): batch = api.get_object(obj) # Doctor doctor = get_field_value(batch, "Doctor", None) item["Doctor"] = doctor and doctor.Title() or "" item["replace"]["Doctor"] = doctor and get_link( api.get_url(doctor), doctor.Title()) # Onset Date onset = get_field_value(batch, "OnsetDate", None) item["OnsetDate"] = onset and self.listing.ulocalized_time(onset) or "" # Patient item["Patient"] = "" item["getPatientID"] = "" item["getClientPatientID"] = "" item["PatientAgeOnsetDate"] = "" patient = get_field_value(batch, "Patient", None) if patient: url = api.get_url(patient) item["Patient"] = patient.Title() item["replace"]["Patient"] = get_link(url, patient.Title()) item["getPatientID"] = patient.id item["replace"]["getPatientID"] = get_link(url, patient.id) pid = patient.getClientPatientID() pid_link = pid and get_link(url, pid) or "" item["getClientPatientID"] = pid or "" item["replace"]["getClientPatientID"] = pid_link dob = patient.getBirthDate() if onset and dob: try: age_ymd = get_age_ymd(patient.getBirthDate(), onset) item["replace"]["PatientAgeOnsetDate"] = age_ymd except: # Wrong date?? msg = _("Date of Birth or Case Onset Date are wrong") img = get_image("exclamation.png", title=msg) item["replace"]["PatientAgeOnsetDate"] = img # Display the internal/external icons, but only if the logged-in user # does not belong to an external client if not self.is_external_user: item["before"]["BatchID"] = get_client_aware_html_image(obj) return item
def folderitem(self, obj, item, index): """Service triggered each time an item is iterated in folderitems. The use of this service prevents the extra-loops in child objects. :obj: the instance of the class to be foldered :item: dict containing the properties of the object to be used by the template :index: current index of the item """ # ensure we have an object and not a brain obj = api.get_object(obj) uid = api.get_uid(obj) url = api.get_url(obj) title = api.get_title(obj) # get the category if self.show_categories_enabled(): category = obj.getCategoryTitle() if category not in self.categories: self.categories.append(category) item["category"] = category config = self.configuration.get(uid, {}) hidden = config.get("hidden", False) item["replace"]["Title"] = get_link(url, value=title) item["Price"] = self.format_price(obj.Price) item["allow_edit"] = self.get_editable_columns() item["selected"] = False item["Hidden"] = hidden item["selected"] = uid in self.configuration # Add methods methods = obj.getMethods() if methods: links = map( lambda m: get_link( m.absolute_url(), value=m.Title(), css_class="link"), methods) item["replace"]["Methods"] = ", ".join(links) else: item["methods"] = "" # Icons after_icons = "" if obj.getAccredited(): after_icons += get_image( "accredited.png", title=_("Accredited")) if obj.getAttachmentOption() == "r": after_icons += get_image( "attach_reqd.png", title=_("Attachment required")) if obj.getAttachmentOption() == "n": after_icons += get_image( "attach_no.png", title=_("Attachment not permitted")) if after_icons: item["after"]["Title"] = after_icons return item
def get_link_for(obj, **kwargs): """Returns a well-formed html anchor to the object """ if not obj: return "" href = api.get_url(obj) value = api.get_title(obj) return get_link(href=href, value=value, **kwargs)
def __call__(self): client = api.get_current_client() if client: url = api.get_url(client) ar_count = self.get_ar_count() return self.request.response.redirect( "{}/ar_add?ar_count={}".format(url, ar_count)) return super(AnalysisRequestAddView, self).__call__()
def __init__(self, context, request): super(FormController, self).__init__(context, request) self.context = context self.request = request self.tab = request.form.get("tab", "query") self.exit_url = "{}?tab={}".format(api.get_url(context), self.tab) self.prefix = "senaite.databox"
def __call__(self): client = api.get_current_client() if client: url = api.get_url(client) ar_count = self.get_ar_count() return self.request.response.redirect("{}/ar_add?ar_count={}" .format(url, ar_count)) return super(AnalysisRequestAddView, self).__call__()
def get_obj_url(self, obj): """Returns the absolute url of the object passed-in """ if not api.is_object(obj): # Some objects (e.g. portal_registry) are not supported return obj.absolute_url() return api.get_url(obj)
def __call__(self): client = self.context.getPrimaryReferrer() url = "{}/{}".format(api.get_url(client), "ar_add") qs = self.request.getHeader("query_string") if qs: url = "{}?{}".format(url, qs) self.request.response.redirect(url) return
def folderitem(self, obj, item, index): """Applies new properties to the item (Batch) that is currently being rendered as a row in the list :param obj: client to be rendered as a row in the list :param item: dict representation of the batch, suitable for the list :param index: current position of the item within the list :type obj: ATContentType/DexterityContentType :type item: dict :type index: int :return: the dict representation of the item :rtype: dict """ obj = api.get_object(obj) url = "{}/analysisrequests".format(api.get_url(obj)) bid = api.get_id(obj) cbid = obj.getClientBatchID() title = api.get_title(obj) client = obj.getClient() created = api.get_creation_date(obj) date = obj.getBatchDate() # total sample progress progress = obj.getProgress() item["Progress"] = progress item["replace"]["Progress"] = get_progress_bar_html(progress) item["BatchID"] = bid item["ClientBatchID"] = cbid item["replace"]["BatchID"] = get_link(url, bid) item["Title"] = title item["replace"]["Title"] = get_link(url, title) item["created"] = self.ulocalized_time(created, long_format=True) item["BatchDate"] = self.ulocalized_time(date, long_format=True) if client: client_url = api.get_url(client) client_name = client.getName() client_id = client.getClientID() item["Client"] = client_name item["ClientID"] = client_id item["replace"]["Client"] = get_link(client_url, client_name) item["replace"]["ClientID"] = get_link(client_url, client_id) return item
def __call__(self): client = self.context.getPrimaryReferrer() url = "{}/{}".format(api.get_url(client), "ar_add") qs = self.request.getHeader("query_string") if qs: url = "{}?{}".format(url, qs) self.request.response.redirect(url) return
def folderitem(self, obj, item, index): item['getBirthDate'] = self.ulocalized_time(obj.getBirthDate) # make the columns patient title, patient ID and client patient ID # redirect to the Analysis Requests of the patient ars_url = "{}/{}".format(api.get_url(obj), "analysisrequests") for column in ['Title', 'getPatientID', 'getClientPatientID']: value = getattr(obj, column, None) if value: item["replace"][column] = get_link(ars_url, value) return item
def get_url(brain_or_object): """Proxy to bika.lims.api.get_url """ return api.get_url(brain_or_object)
def get_resource_url(resource, route="++resource++bika.health.images"): """Returns the url for the given resource name """ portal_url = api.get_url(api.get_portal()) return "{}/{}/{}".format(portal_url, route, resource)