def test_add_resource_on_request_with_subrequest(self): """Check, if a resource added at a main request is picked up from a subrequest for creating the header scripts section. """ req = self.layer['request'] # create a subrequest. subreq = req.clone() subreq['PARENT_REQUEST'] = req # add a resource to main request add_resource_on_request(req, 'foo') scripts = ScriptsView(self.layer['portal'], subreq, None) scripts.update() results = scripts.scripts() self.assertEqual( results[-1], { 'src': 'http://nohost/plone/++resource++foo.js', 'conditionalcomment': '', 'resetrjs': False, 'bundle': 'none', }) styles = StylesView(self.layer['portal'], subreq, None) styles.update() results = styles.styles() self.assertEqual( filter(lambda it: 'foo' in it['src'], results)[0], { 'src': 'http://nohost/plone/++resource++foo.css', 'conditionalcomment': '', 'rel': 'stylesheet', 'bundle': 'none', })
def __call__(self): # utility function to add resource to rendered page add_resource_on_request(self.request, 'castle-components-manage-archives') if self.request.form.get('api'): self.request.response.setHeader('Content-type', 'application/json') return json.dumps(AWSApi(self.context, self.request)()) return self.index()
def test_request_resources(self): add_resource_on_request(self.layer['request'], 'foo') scripts = ScriptsView(self.layer['portal'], self.layer['request'], None) scripts.update() results = scripts.scripts() self.assertEqual( results[-1], {'src': 'http://nohost/plone/++resource++foo.js', 'conditionalcomment': '', 'bundle': 'none'})
def __call__(self): if api.user.is_anonymous(): self.request.response.redirect( self.context.absolute_url() + '/login_form?came_from=./@@show-reservations') else: # load JS resources add_resource_on_request(self.request, 'unikold.timeslots') return super(ShowReservationsView, self).__call__()
def test_request_resources(self): add_resource_on_request(self.layer['request'], 'foo') scripts = ScriptsView(self.layer['portal'], self.layer['request'], None) scripts.update() results = scripts.scripts() self.assertEqual( results[-1], {'src': 'http://nohost/plone/++resource++foo.js', 'conditionalcomment': '', 'bundle': 'none'})
def __call__(self, *args, **kwargs): add_resource_on_request(self.request, 'untitled-js') current_user = api.user.get_current() roles = api.user.get_roles(user=current_user) if 'Participant_Applicant' in roles: owner = self.context.getOwner() if not current_user.getId() == owner.getId(): msg = "You cannot edit an OIE Participant Application which you do not own." # noqa return msg return super(ParticipantEditForm, self).__call__(*args, **kwargs)
def setup(self): self.portal_state = queryMultiAdapter( (self.context, self.request), name='plone_portal_state', ) self.registry = getUtility(IRegistry) self._get_data() if PLONE_5: from Products.CMFPlone.resources import add_resource_on_request if self.use_fotorama(): add_resource_on_request(self.request, 'psplonefotorama')
def __call__(self): # utility function to add resource to rendered page add_resource_on_request(self.request, 'castle-components-history') alsoProvides(self.request, IDisableCSRFProtection) self.version_info = None for version in self.versions: if str(version['version_id']) == self.request.form.get('version'): self.version_info = version return self.template()
def __call__(self): # utility function to add resource to rendered page add_resource_on_request(self.request, 'castle-components-review-archives') extend = self.request.form.get('extend') if extend: obj = uuidToObject(extend) obj.setModificationDate(DateTime()) obj.reindexObject(idxs=['modified']) return self.json_dump() return self.index()
def render_widget(self, widget): add_resource_on_request(self.request, 'pkanwidgets') title = translate( 'heading_add_item', domain='plone', mapping={'itemtype': self.portal_type_name}, context=self.request, default='Add ${itemtype}', ) return MARKUP.format( klass=u'context', title=title, url=self.add_url, widget=widget, )
def __call__(self): # utility function to add resource to rendered page add_resource_on_request(self.request, 'castle-components-audit') self._user_cache = {} self.site_path = '/'.join(self.context.getPhysicalPath()) try: results = self.do_query() self.results = results['hits']['hits'] self.total = results['hits']['total']['value'] if 'Export' in self.request.form.get('export', ''): return self.export() except Exception: self.inner_template = self.error_template return super(AuditView, self).__call__()
def setup(self): self.registry = getUtility(IRegistry) # noqa if PLONE_5: from Products.CMFPlone.resources import add_resource_on_request if self.use_fotorama(): add_resource_on_request(self.request, 'psplonefotorama') try: pkg_resources.get_distribution('ps.plone.realestatefont') except pkg_resources.DistributionNotFound: pass else: from Products.GenericSetup.tool import UNKNOWN setup = plone_api.portal.get_tool(name='portal_setup') profile = 'profile-ps.plone.realestatefont:default' if setup.getLastVersionForProfile(profile) != UNKNOWN: add_resource_on_request( self.request, 'psplonerealestatefont', )
def rich_text_args(self): args = super(RichTextWidget, self)._base_args() args['name'] = self.name value = self.value and self.value.raw_encoded or '' args['value'] = (self.request.get(self.field.getName(), value)).decode('utf-8') args.setdefault('pattern_options', {}) # displays tinymce editor for anonymous users if api.user.is_anonymous(): add_resource_on_request(self.request, 'mockup-patterns-tinymce-logged-out') merged_options = dict_merge( get_tinymce_options(self.context, self.field, self.request), # noqa args['pattern_options']) args['pattern_options'] = merged_options return args
def test_add_resource_on_request_with_subrequest(self): """Check, if a resource added at a main request is picked up from a subrequest for creating the header scripts section. """ req = self.layer['request'] # create a subrequest. subreq = req.clone() subreq['PARENT_REQUEST'] = req # add a resource to main request add_resource_on_request(req, 'foo') scripts = ScriptsView(self.layer['portal'], subreq, None) scripts.update() results = scripts.scripts() self.assertEqual( results[-1], { 'src': 'http://nohost/plone/++resource++foo.js', 'conditionalcomment': '', 'resetrjs': False, 'bundle': 'none', } ) styles = StylesView(self.layer['portal'], subreq, None) styles.update() results = styles.styles() self.assertEqual( filter(lambda it: 'foo' in it['src'], results)[0], { 'src': 'http://nohost/plone/++resource++foo.css', 'conditionalcomment': '', 'rel': 'stylesheet', 'bundle': 'none', } )
def render(self): widget = super(RelatedItemsWidget, self).render() if self.mode != 'input': return widget if self.content_type is None: return widget add_resource_on_request(self.request, 'ploneformwidgetrelateditems') title = translate( 'heading_add_item', domain='plone', mapping={'itemtype': self.portal_type_name}, context=self.request, default='Add ${itemtype}', ) return MARKUP.format( klass=u'context', title=title, url=self.add_url, widget=widget, )
def render_widget(self, widget): add_resource_on_request(self.request, 'pkanpatterncontentloaderform') title = translate( 'heading_preview', domain='pkan.widgets', mapping={}, context=self.request, default='Update Preview', ) if self.form.ignoreContext: context_url = '' else: try: context_url = self.context.absolute_url() except AttributeError: if getattr(self.form, 'parentForm', None): context_url = self.form.parentForm.context.absolute_url() else: context_url = self.form.context.absolute_url() url = '/'.join([ context_url, '@@harvester_preview', ]) preview_url = url return MARKUP.format( klass=u'context', preview_url=preview_url, title=title, url=url, widget=widget, form_id=self.form.id, query_id=self.id, target_id=self.id + '__preview', )
def __call__(self): add_resource_on_request(self.request, "iframeResizer") return super(IssueView, self).__call__()
def __init__(self, context, request): # Each view instance receives context and request as construction parameters self.context = context self.request = request add_resource_on_request(self.request, 'load-more')
def __call__(self): self._update() add_resource_on_request(self.request, 'documentviewer') self.site = api.portal.get() self.settings = Settings(self.context) self.global_settings = GlobalSettings(self.site) self.portal_url = getMultiAdapter( (self.context, self.request), name="plone_portal_state").portal_url() self.dvstatic = "%s/++resource++dv.resources" % ( self.portal_url) resource_url = self.global_settings.override_base_resource_url rel_url = storage.getResourceRelURL(gsettings=self.global_settings, settings=self.settings) if resource_url: self.dvpdffiles = '%s/%s' % (resource_url.rstrip('/'), rel_url) else: self.dvpdffiles = '%s/%s' % (self.portal_url, rel_url) utils = getToolByName(self.context, 'plone_utils') msg = None self.enabled = True if allowedDocumentType(self.context, self.global_settings.auto_layout_file_types): if not self.installed: msg = _("Since you do not have docsplit installed on this " "system, we can not render the pages of this document.") if self.settings.converting is not None and \ self.settings.converting: if self.settings.successfully_converted: # there is a version that is already converted, show it. self.enabled = True msg = _("A new conversion to the Document Viewer " "is currently being generated for this document." ) else: msg = _("The document is currently being converted to the " "Document Viewer view.") self.enabled = False elif self.settings.successfully_converted is not None and \ not self.settings.successfully_converted: msg = _("There was an error trying to convert the document. " "Maybe the document is encrypted, corrupt or " "malformed? Check log for details.") self.enabled = False elif self.settings.successfully_converted is None: # must have just switched to this view msg = _("This document is not yet converted to document " "viewer. Please click the `Document Viewer Convert` " "button in the actions menu to convert.") self.enabled = False else: self.enabled = False msg = _("The file is not a supported document type. " "Your type may be supported. Check out the document " "viewer configuration settings.") mtool = getToolByName(self.context, 'portal_membership') self.can_modify = mtool.checkPermission('Modify portal content', self.context) if msg and self.can_modify: utils.addPortalMessage(_(msg)) return self.index()
def __call__(self): add_resource_on_request(self.request, "static.js.rec") request = self.request if "usn_update" in request.form: # need to know if the site has free kits, requires siteID, and to # get free_kits_left need to pass billing status to make sample # def, default will be billable_code will be "Billable" with no # billable_code_designation need to alert user if the kit site is # a sales person so the value can be updated, sales person needs # to add the kits to the site for this to work authenticator = request.form.get('_authenticator') plone.protect.CheckAuthenticator(authenticator) # define request.form.get's usn = request.form.get('usn') site_id = request.form.get('site_id') # Do things usn_check = self.check_unique_sample_id(usn) site_name = self.site_lookup(site_id) check_if_site_is_sales_rep = self.check_if_site_is_sales_rep( site_id) docs_at_barcode_site = self.providers_at_site(site_id) if check_if_site_is_sales_rep is True: return json.dumps( {"site_name": site_name, "docs_at_barcode_site": docs_at_barcode_site, "sales_rep_kit": check_if_site_is_sales_rep}) elif usn_check != "non unique usn": return json.dumps( {"site_name": site_name, "docs_at_barcode_site": docs_at_barcode_site}) if "check_name_and_dob" in request.form: authenticator = request.form.get('_authenticator') plone.protect.CheckAuthenticator(authenticator) # define request.form.get's pt_UID = "new_patient" dob_string = request.form.get('dob') # string value '%Y-%m-%d' patient_first_name = request.form.get('patient_first_name') patient_last_name = request.form.get('patient_last_name') pt_UID = self.repeat_order_check(dob_string, patient_first_name, patient_last_name, pt_UID) if pt_UID != "new_patient": previous_data = self.pull_previous_patient_data(pt_UID) return json.dumps({"repeat order": "true", "Pt Data from LIMS": previous_data}) else: return json.dumps({"repeat order": "false"}) # Do things # orders can be repeat with only first name or medical # record number and dob! Think of it as a de-identified sample if "all_data" in request.form: authenticator = request.form.get('_authenticator') plone.protect.CheckAuthenticator(authenticator) # Patient Data Elemetns usn_from_form = request.form.get('usn_from_from') site_id = request.form.get('site_id') dob = request.form.get('dob') first = request.form.get('patient_first_name') last = request.form.get('patient_last_name') mrn = request.form.get('mrn') ssn = request.form.get('ssn') gender = request.form.get('gender') marital_status = request.form.get('marital_status') ethnicity = request.form.get('ethnicity') ethnicity_other = request.form.get('ethnicity_specify') patient_address = request.form.get('p_add_street') patient_city = request.form.get('p_add_city') patient_state = request.form.get('p_state') patient_zip_code = request.form.get('p_add_zip') patient_phone = request.form.get('patient_phone') # Clinical Sample Data consent_acquired = request.form.get('consent_acquired') consent_signed = request.form.get('consent_signed') consent_date = request.form.get('consent_date') ana_testing = request.form.get('ana_testing') clinical_impression = request.form.get('clinical_impression') test_xray = request.form.get('test_xray') raw_test_other = request.form.get('test_other') test_other = [] test_other.append(raw_test_other) test_other_specify = request.form.get('test_other_specify') clin_rash = request.form.get('clin_rash') clin_seiz_psych = request.form.get('clin_seiz_psych') clin_mouth_sores = request.form.get('clin_mouth_sores') clin_hair_loss = request.form.get('clin_hair_loss') clin_joint_pain = request.form.get('clin_joint_pain') clin_inflam = request.form.get('clin_inflam') clin_other = request.form.get('clin_other') clin_other_specify = request.form.get('clin_other_specify') diag_D89_89 = request.form.get('diag_D89_89') diag_M32_10 = request.form.get('diag_M32_10') diag_D89_9 = request.form.get('diag_D89_9') diag_M35_9 = request.form.get('diag_M35_9') diag_L93_2 = request.form.get('diag_L93_2') diag_other = request.form.get('diag_other') diag_other_specify = request.form.get('diag_other_specify') provider_nip_clean = request.form.get('provider_nip_clean') provider_signed = request.form.get('provider_signed') draw_location = request.form.get('draw_location') draw_tel = request.form.get('draw_tel') phlebotomist_name = request.form.get('phlebotomist_name') draw_signed = request.form.get('draw_signed') collection_date = request.form.get('collection_date') shipment_date = request.form.get('shipment_date') ordering_provider_name = request.form.get('ordering_provider_name') billable_primary = request.form.get('billing_primary') billable_secondary = request.form.get('billing_secondary') assay_selection_raw = request.form.get('assay_choice[]') other_clinical_symptoms = request.form.get('clin_other_specify') other_inflam = request.form.get('clin_inflam_specify') other_joint_pain = request.form.get('clin_joint_pain_specify') # case for single assay selected assay_selection = [] if isinstance(assay_selection_raw, basestring): assay_selection.insert(0, assay_selection_raw) # case for multiple assay choices selected if isinstance(assay_selection_raw, list): for i in assay_selection_raw: assay_selection.append(i) pt_UID = "new_patient" # See if we have an existing pt missing_date_feedback = json.dumps( {"feedback": "Missing Key Data Elements"}) # protection for making samples and new patient records, usn must # be unique, first name not null, dob not null, collection date # not null if usn_from_form == 'undefined-undefined': return missing_date_feedback elif first == '': return missing_date_feedback elif dob == '': return missing_date_feedback elif collection_date == '': return missing_date_feedback else: pt_UID = self.repeat_order_check(dob, first, last, pt_UID) if pt_UID != "new_patient": msg = "PT UID: %s, Form USN: %s" % (pt_UID, usn_from_form) logger.info(msg) # update existing record self.update_existing_patient_data( pt_UID, dob, first, last, mrn, ssn, gender, marital_status, ethnicity, ethnicity_other, patient_address, patient_city, patient_state, patient_zip_code, patient_phone) self.append_usn(usn_from_form, pt_UID) else: print "Make a new patient record" self.make_patient( first, last, ssn, mrn, dob, gender, ethnicity, ethnicity_other, marital_status, patient_address, patient_city, patient_state, patient_zip_code, patient_phone, usn_from_form) sample_UID = self.make_clinical_sample( usn_from_form, consent_acquired, ana_testing, clin_rash, clin_seiz_psych, clin_mouth_sores, clin_hair_loss, clin_joint_pain, clin_inflam, clin_other, clin_other_specify, diag_D89_89, diag_M32_10, diag_D89_9, diag_M35_9, diag_L93_2, diag_other, diag_other_specify, provider_nip_clean, provider_signed, draw_location, draw_tel, phlebotomist_name, draw_signed, collection_date, shipment_date, test_other_specify, clinical_impression, ordering_provider_name, site_id, assay_selection, other_clinical_symptoms, other_inflam, other_joint_pain) # make bulk aliquots # fancy way to have multiple tubes in the system, update letter # list as more tubes are added easy way draw_tubes = ['A', 'B'] bulk_aliquotA = self.make_bulk_aliquots( sample_UID, usn_from_form, draw_tubes[0]) bulk_aliquotB = self.make_bulk_aliquots( sample_UID, usn_from_form, draw_tubes[1]) # make working aliquots working_tubes = ['02', '03', '04'] working_aliquotA02 = self.make_working_aliquots( usn_from_form, bulk_aliquotA, working_tubes[0]) working_aliquotA03 = self.make_working_aliquots( usn_from_form, bulk_aliquotA, working_tubes[1]) working_aliquotA04 = self.make_working_aliquots( usn_from_form, bulk_aliquotA, working_tubes[2]) # make assay request(s) # make billing request(s) # for t in tubes: # exec ("bulk_aliquot" %t) = self.make_bulk_aliquots( # sample_UID, usn_from_form, t) # print"bulk_aliquot" % (t) # make working aliquots try: self.update_kit_count(site_id) except: print "Kit Count for Site " + site_id + " Failed to Update" # add aliquots to box for storage! # file bulk aliquots (update aliquot to have value) # file working aliquots (update aliquots to have value) return json.dumps({"feedback": "Successful Sample"}) return self.template()
def test_request_resources_not_add_same_twice(self): req = self.layer['request'] add_resource_on_request(req, 'foo') add_resource_on_request(req, 'foo') self.assertEqual(len(req.enabled_resources), 1)
def render(self): # add the registered resource add_resource_on_request(self.request, 'exercise6') return super(MinSizeImageWidget, self).render()
def __call__(self): add_resource_on_request(self.request, 'upload-bootstrap') add_bundle_on_request(self.request, 'jqueryui') add_resource_on_request(self.request, 'jquery-fileupload') return super(ChunkedFileView, self).__call__(self)
def resources_include(): request = getRequest() for resource in RESOURCES: add_resource_on_request(request, resource)
def __call__(self): # load JS resources add_resource_on_request(self.request, 'unikold.timeslots') return super(UTSignupSheetView, self).__call__()
def __call__(self): add_resource_on_request(self.request, 'ploneorg-addonlisting') return super(AddOnFolderView, self).__call__()
def __call__(self): add_resource_on_request(self.request, 'bluechurch_profile_features') return super(BluechurchmembraneprofileView, self).__call__()
def __call__(self, *args, **kw): add_resource_on_request(self.request, 'untitled-js') super(ParticipantAddForm, self).__call__(*args, **kw)
def __call__(self): if IS_PLONE_5: add_resource_on_request(self.request, 'iframeResizer') return super(IssueView, self).__call__()
def __call__(self): add_resource_on_request(self.request, "relatedmedia") return super(RelatedMediaRenderWidget, self).__call__()
def __init__(self,context, request): # Each view instance receives context and request as construction parameters self.context = context self.request = request add_resource_on_request(self.request, 'jquery-lightbox')
def __call__(self): self._update() add_resource_on_request(self.request, 'documentviewer') self.site = api.portal.get() self.settings = Settings(self.context) self.global_settings = GlobalSettings(self.site) self.portal_url = getMultiAdapter( (self.context, self.request), name="plone_portal_state").portal_url() self.dvstatic = "%s/++resource++dv.resources" % (self.portal_url) resource_url = self.global_settings.override_base_resource_url rel_url = storage.getResourceRelURL(gsettings=self.global_settings, settings=self.settings) if resource_url: self.dvpdffiles = '%s/%s' % (resource_url.rstrip('/'), rel_url) else: self.dvpdffiles = '%s/%s' % (self.portal_url, rel_url) utils = getToolByName(self.context, 'plone_utils') msg = None self.enabled = True if allowedDocumentType(self.context, self.global_settings.auto_layout_file_types): if not self.installed: msg = _( "Since you do not have docsplit installed on this " "system, we can not render the pages of this document.") if self.settings.converting is not None and \ self.settings.converting: if self.settings.successfully_converted: # there is a version that is already converted, show it. self.enabled = True msg = _("A new conversion to the Document Viewer " "is currently being generated for this document.") else: msg = _("The document is currently being converted to the " "Document Viewer view.") self.enabled = False elif self.settings.successfully_converted is not None and \ not self.settings.successfully_converted: msg = _("There was an error trying to convert the document. " "Maybe the document is encrypted, corrupt or " "malformed? Check log for details.") self.enabled = False elif self.settings.successfully_converted is None: # must have just switched to this view msg = _("This document is not yet converted to document " "viewer. Please click the `Document Viewer Convert` " "button in the actions menu to convert.") self.enabled = False else: self.enabled = False msg = _("The file is not a supported document type. " "Your type may be supported. Check out the document " "viewer configuration settings.") mtool = getToolByName(self.context, 'portal_membership') self.can_modify = mtool.checkPermission('Modify portal content', self.context) if msg and self.can_modify: utils.addPortalMessage(_(msg)) return self.index()
def __init__(self,context, request): # Each view instance receives context and request as construction parameters self.context = context self.request = request add_resource_on_request(self.request, 'xsgs-homepage')
def __call__(self): # utility function to add resource to rendered page add_resource_on_request(self.request, 'datetimepicker') return super(DateTimePickerView, self).__call__()
def render(self): # add the registered resource add_resource_on_request(self.request, 'exercise7') return super(MinSizeImageWidget, self).render()
def add_resource_on_request(self, resource): add_resource_on_request(self.request, resource)
def __init__(self, context, request): # Each view instance receives context and request as construction parameters self.context = context self.request = request add_bundle_on_request(self.request, 'workspace-legacy') add_resource_on_request(self.request, 'iphone-style')
def __call__(self): add_resource_on_request(self.request, "static.js.rec") request = self.request if "usn_update" in request.form: # need to know if the site has free kits, requires siteID, and to # get free_kits_left need to pass billing status to make sample # def, default will be billable_code will be "Billable" with no # billable_code_designation need to alert user if the kit site is # a sales person so the value can be updated, sales person needs # to add the kits to the site for this to work authenticator = request.form.get('_authenticator') plone.protect.CheckAuthenticator(authenticator) # define request.form.get's usn = request.form.get('usn') site_id = request.form.get('site_id') # Do things usn_check = self.check_unique_sample_id(usn) site_name = self.site_lookup(site_id) check_if_site_is_sales_rep = self.check_if_site_is_sales_rep( site_id) docs_at_barcode_site = self.providers_at_site(site_id) if check_if_site_is_sales_rep is True: return json.dumps({ "site_name": site_name, "docs_at_barcode_site": docs_at_barcode_site, "sales_rep_kit": check_if_site_is_sales_rep }) elif usn_check != "non unique usn": return json.dumps({ "site_name": site_name, "docs_at_barcode_site": docs_at_barcode_site }) if "check_name_and_dob" in request.form: authenticator = request.form.get('_authenticator') plone.protect.CheckAuthenticator(authenticator) # define request.form.get's pt_UID = "new_patient" dob_string = request.form.get('dob') # string value '%Y-%m-%d' patient_first_name = request.form.get('patient_first_name') patient_last_name = request.form.get('patient_last_name') pt_UID = self.repeat_order_check(dob_string, patient_first_name, patient_last_name, pt_UID) if pt_UID != "new_patient": previous_data = self.pull_previous_patient_data(pt_UID) return json.dumps({ "repeat order": "true", "Pt Data from LIMS": previous_data }) else: return json.dumps({"repeat order": "false"}) # Do things # orders can be repeat with only first name or medical # record number and dob! Think of it as a de-identified sample if "all_data" in request.form: authenticator = request.form.get('_authenticator') plone.protect.CheckAuthenticator(authenticator) # Patient Data Elemetns usn_from_form = request.form.get('usn_from_from') site_id = request.form.get('site_id') dob = request.form.get('dob') first = request.form.get('patient_first_name') last = request.form.get('patient_last_name') mrn = request.form.get('mrn') ssn = request.form.get('ssn') gender = request.form.get('gender') marital_status = request.form.get('marital_status') ethnicity = request.form.get('ethnicity') ethnicity_other = request.form.get('ethnicity_specify') patient_address = request.form.get('p_add_street') patient_city = request.form.get('p_add_city') patient_state = request.form.get('p_state') patient_zip_code = request.form.get('p_add_zip') patient_phone = request.form.get('patient_phone') # Clinical Sample Data consent_acquired = request.form.get('consent_acquired') consent_signed = request.form.get('consent_signed') consent_date = request.form.get('consent_date') ana_testing = request.form.get('ana_testing') clinical_impression = request.form.get('clinical_impression') test_xray = request.form.get('test_xray') raw_test_other = request.form.get('test_other') test_other = [] test_other.append(raw_test_other) test_other_specify = request.form.get('test_other_specify') clin_rash = request.form.get('clin_rash') clin_seiz_psych = request.form.get('clin_seiz_psych') clin_mouth_sores = request.form.get('clin_mouth_sores') clin_hair_loss = request.form.get('clin_hair_loss') clin_joint_pain = request.form.get('clin_joint_pain') clin_inflam = request.form.get('clin_inflam') clin_other = request.form.get('clin_other') clin_other_specify = request.form.get('clin_other_specify') diag_D89_89 = request.form.get('diag_D89_89') diag_M32_10 = request.form.get('diag_M32_10') diag_D89_9 = request.form.get('diag_D89_9') diag_M35_9 = request.form.get('diag_M35_9') diag_L93_2 = request.form.get('diag_L93_2') diag_other = request.form.get('diag_other') diag_other_specify = request.form.get('diag_other_specify') provider_nip_clean = request.form.get('provider_nip_clean') provider_signed = request.form.get('provider_signed') draw_location = request.form.get('draw_location') draw_tel = request.form.get('draw_tel') phlebotomist_name = request.form.get('phlebotomist_name') draw_signed = request.form.get('draw_signed') collection_date = request.form.get('collection_date') shipment_date = request.form.get('shipment_date') ordering_provider_name = request.form.get('ordering_provider_name') billable_primary = request.form.get('billing_primary') billable_secondary = request.form.get('billing_secondary') assay_selection_raw = request.form.get('assay_choice[]') other_clinical_symptoms = request.form.get('clin_other_specify') other_inflam = request.form.get('clin_inflam_specify') other_joint_pain = request.form.get('clin_joint_pain_specify') # case for single assay selected assay_selection = [] if isinstance(assay_selection_raw, basestring): assay_selection.insert(0, assay_selection_raw) # case for multiple assay choices selected if isinstance(assay_selection_raw, list): for i in assay_selection_raw: assay_selection.append(i) pt_UID = "new_patient" # See if we have an existing pt missing_date_feedback = json.dumps( {"feedback": "Missing Key Data Elements"}) # protection for making samples and new patient records, usn must # be unique, first name not null, dob not null, collection date # not null if usn_from_form == 'undefined-undefined': return missing_date_feedback elif first == '': return missing_date_feedback elif dob == '': return missing_date_feedback elif collection_date == '': return missing_date_feedback else: pt_UID = self.repeat_order_check(dob, first, last, pt_UID) if pt_UID != "new_patient": msg = "PT UID: %s, Form USN: %s" % (pt_UID, usn_from_form) logger.info(msg) # update existing record self.update_existing_patient_data( pt_UID, dob, first, last, mrn, ssn, gender, marital_status, ethnicity, ethnicity_other, patient_address, patient_city, patient_state, patient_zip_code, patient_phone) self.append_usn(usn_from_form, pt_UID) else: print "Make a new patient record" self.make_patient(first, last, ssn, mrn, dob, gender, ethnicity, ethnicity_other, marital_status, patient_address, patient_city, patient_state, patient_zip_code, patient_phone, usn_from_form) sample_UID = self.make_clinical_sample( usn_from_form, consent_acquired, ana_testing, clin_rash, clin_seiz_psych, clin_mouth_sores, clin_hair_loss, clin_joint_pain, clin_inflam, clin_other, clin_other_specify, diag_D89_89, diag_M32_10, diag_D89_9, diag_M35_9, diag_L93_2, diag_other, diag_other_specify, provider_nip_clean, provider_signed, draw_location, draw_tel, phlebotomist_name, draw_signed, collection_date, shipment_date, test_other_specify, clinical_impression, ordering_provider_name, site_id, assay_selection, other_clinical_symptoms, other_inflam, other_joint_pain) # make bulk aliquots # fancy way to have multiple tubes in the system, update letter # list as more tubes are added easy way draw_tubes = ['A', 'B'] bulk_aliquotA = self.make_bulk_aliquots( sample_UID, usn_from_form, draw_tubes[0]) bulk_aliquotB = self.make_bulk_aliquots( sample_UID, usn_from_form, draw_tubes[1]) # make working aliquots working_tubes = ['02', '03', '04'] working_aliquotA02 = self.make_working_aliquots( usn_from_form, bulk_aliquotA, working_tubes[0]) working_aliquotA03 = self.make_working_aliquots( usn_from_form, bulk_aliquotA, working_tubes[1]) working_aliquotA04 = self.make_working_aliquots( usn_from_form, bulk_aliquotA, working_tubes[2]) # make assay request(s) # make billing request(s) # for t in tubes: # exec ("bulk_aliquot" %t) = self.make_bulk_aliquots( # sample_UID, usn_from_form, t) # print"bulk_aliquot" % (t) # make working aliquots try: self.update_kit_count(site_id) except: print "Kit Count for Site " + site_id + " Failed to Update" # add aliquots to box for storage! # file bulk aliquots (update aliquot to have value) # file working aliquots (update aliquots to have value) return json.dumps({"feedback": "Successful Sample"}) return self.template()
def __init__(self, context, request): super(Pantry, self).__init__(context, request) add_resource_on_request(self.request, 'prismjs') add_resource_on_request(self.request, 'mockup-patterns-toggle')
def test_request_resources_not_add_same_twice(self): req = self.layer['request'] add_resource_on_request(req, 'foo') add_resource_on_request(req, 'foo') self.assertEqual(len(req.enabled_resources), 1)
def __call__(self): add_resource_on_request(self.request, "iframeResizer") return self.index()
def __call__(self): # utility function to add resource to rendered page add_resource_on_request(self.request, 'exercise2') return super(Exercise2View, self).__call__()
def __call__(self): # utility function to add resource to rendered page add_resource_on_request(self.request, 'castle-components-history') return super(HistoryView, self).__call__()
def setup(self): if PLONE_5: from Products.CMFPlone.resources import add_resource_on_request add_resource_on_request(self.request, 'psplonerealestatefont')