Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecation warnings. #353

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ Changelog
- #345 'SearchableText' field and adapter in Batches.
- #348 Add Attachment objects to portal_catalog, to allow idserver to function correctly.
- #352 Fix traceback on listings
- #353 Remove deprecation warnings
- #364 Error on Manage Results view while Adding new Analyses from different Category
- #365 Lims Installation fails during setting client permissions in bika setup.
- #358 Merged updates for AR Add2
- #371 Reflex Rules don't have 'inactive_state' values set.


1.0.0 (2017-10-13)
------------------

Expand Down
4 changes: 2 additions & 2 deletions bika/lims/browser/aggregatedanalyses/aggregatedanalyses.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def __init__(self, context, request, **kwargs):

self.columns['AnalysisRequest'] = {
'title': _('Analysis Request'),
'attr': 'getAnalysisRequestTitle',
'replace_url': 'getAnalysisRequestURL',
'attr': 'getRequestTitle',
'replace_url': 'getRequestURL',
'sortable': False
}
self.columns['Worksheet'] = {
Expand Down
19 changes: 0 additions & 19 deletions bika/lims/browser/analyses.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,25 +243,6 @@ def ResultOutOfRange(self, analysis):
# By default, not out of range
return False

@deprecated('[1703] Orphan. No alternative')
def getAnalysisSpecsStr(self, spec):
"""
Generates a string representation of the specifications passed in. If
neither min nor max values found, returns an empty string

:param spec: specifications dict, with 'min' and 'max' keys
:type spec: dict
:returns: a string representation of the passed in specs
:rtype: string
"""
if spec['min'] and spec['max']:
return '%s - %s' % (spec['min'], spec['max'])
if spec['min']:
return '> %s' % spec['min']
if spec['max']:
return '< %s' % spec['max']
return ''

def get_methods_vocabulary(self, analysis=None):
"""
Returns a vocabulary with all the methods available for the passed in
Expand Down
38 changes: 19 additions & 19 deletions bika/lims/browser/analysisrequest/analysisrequests.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def __init__(self, context, request):
'title': 'Progress',
'sortable': False,
'toggle': True},
'getRequestID': {
'getId': {
'title': _('Request ID'),
'attr': 'getId',
'replace_url': 'absolute_url',
Expand Down Expand Up @@ -233,7 +233,7 @@ def __init__(self, context, request):
'url': 'workflow_action?action=print_stickers'}],
'columns': ['Priority',
'Progress',
'getRequestID',
'getId',
'getSample',
'BatchID',
# 'SubGroup',
Expand Down Expand Up @@ -276,7 +276,7 @@ def __init__(self, context, request):
'title': _('Print stickers'),
'url': 'workflow_action?action=print_stickers'}],
'columns': ['Priority',
'getRequestID',
'getId',
'getSample',
'BatchID',
# 'SubGroup',
Expand Down Expand Up @@ -316,7 +316,7 @@ def __init__(self, context, request):
'title': _('Print stickers'),
'url': 'workflow_action?action=print_stickers'}],
'columns': ['Priority',
'getRequestID',
'getId',
'getSample',
'BatchID',
# 'SubGroup',
Expand Down Expand Up @@ -354,7 +354,7 @@ def __init__(self, context, request):
'title': _('Print stickers'),
'url': 'workflow_action?action=print_stickers'}],
'columns': ['Priority',
'getRequestID',
'getId',
'getSample',
'BatchID',
# 'SubGroup',
Expand Down Expand Up @@ -398,7 +398,7 @@ def __init__(self, context, request):
'title': _('Print stickers'),
'url': 'workflow_action?action=print_stickers'}],
'columns': ['Priority',
'getRequestID',
'getId',
'getSample',
'BatchID',
# 'SubGroup',
Expand Down Expand Up @@ -438,7 +438,7 @@ def __init__(self, context, request):
'title': _('Print stickers'),
'url': 'workflow_action?action=print_stickers'}],
'columns': ['Priority',
'getRequestID',
'getId',
'getSample',
'BatchID',
# 'SubGroup',
Expand Down Expand Up @@ -480,7 +480,7 @@ def __init__(self, context, request):
'title': _('Print stickers'),
'url': 'workflow_action?action=print_stickers'}],
'columns': ['Priority',
'getRequestID',
'getId',
'getSample',
'BatchID',
# 'SubGroup',
Expand Down Expand Up @@ -520,7 +520,7 @@ def __init__(self, context, request):
'title': _('Print stickers'),
'url': 'workflow_action?action=print_stickers'}],
'columns': ['Priority',
'getRequestID',
'getId',
'getSample',
'BatchID',
# 'SubGroup',
Expand Down Expand Up @@ -555,7 +555,7 @@ def __init__(self, context, request):
'transitions': [{'id': 'republish'}],
'custom_transitions': [],
'columns': ['Priority',
'getRequestID',
'getId',
'getSample',
'BatchID',
# 'SubGroup',
Expand Down Expand Up @@ -601,7 +601,7 @@ def __init__(self, context, request):
'sort_order': 'reverse'},
'transitions': [{'id': 'reinstate'}],
'custom_transitions': [],
'columns': ['getRequestID',
'columns': ['getId',
'getSample',
'BatchID',
# 'SubGroup',
Expand Down Expand Up @@ -640,7 +640,7 @@ def __init__(self, context, request):
'id': 'print_stickers',
'title': _('Print stickers'),
'url': 'workflow_action?action=print_stickers'}],
'columns':['getRequestID',
'columns':['getId',
'getSample',
'BatchID',
# 'SubGroup',
Expand Down Expand Up @@ -690,7 +690,7 @@ def __init__(self, context, request):
'title': _('Print stickers'),
'url': 'workflow_action?action=print_stickers'}],
'columns': ['Priority',
'getRequestID',
'getId',
'getSample',
'BatchID',
# 'SubGroup',
Expand Down Expand Up @@ -741,7 +741,7 @@ def __init__(self, context, request):
'title': _('Print stickers'),
'url': 'workflow_action?action=print_stickers'}],
'columns': ['Priority',
'getRequestID',
'getId',
'getSample',
'BatchID',
# 'SubGroup',
Expand Down Expand Up @@ -780,7 +780,7 @@ def __init__(self, context, request):
'id': 'print_stickers',
'title': _('Print stickers'),
'url': 'workflow_action?action=print_stickers'}],
'columns': ['getRequestID',
'columns': ['getId',
'getSample',
'BatchID',
# 'SubGroup',
Expand Down Expand Up @@ -865,10 +865,10 @@ def folderitem(self, obj, item, index):
priority_text = PRIORITIES.getValue(priority)
priority_div = '<div class="priority-ico priority-%s"><span class="notext">%s</span><div>'
item['replace']['Priority'] = priority_div % (priority, priority_text)
item['getRequestID'] = obj.getId
item['getId'] = obj.getId
url = obj.getURL() + "?check_edit=1"
item['replace']['getRequestID'] = "<a href='%s'>%s</a>" % \
(url, item['getRequestID'])
item['replace']['getId'] = "<a href='%s'>%s</a>" % \
(url, item['getId'])
item['replace']['getProfilesTitle'] =\
", ".join(obj.getProfilesTitleStr)

Expand Down Expand Up @@ -962,7 +962,7 @@ def folderitem(self, obj, item, index):
after_icons += "<img src='%s/++resource++bika.lims.images/hazardous.png' title='%s'>" % \
(self.portal_url, t(_("Hazardous")))
if after_icons:
item['after']['getRequestID'] = after_icons
item['after']['getId'] = after_icons

item['Created'] = self.ulocalized_time(obj.created)
if obj.getContactUID:
Expand Down
2 changes: 1 addition & 1 deletion bika/lims/browser/analysisrequest/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __call__(self):
self.clientSampleId = sample.getClientSampleID()
self.sampleType = sample.getSampleType().Title()
self.samplePoint = samplePoint and samplePoint.Title()
self.requestId = context.getRequestID()
self.requestId = context.getId()
self.headers = [
{'title': 'Invoice ID', 'value': self.invoiceId},
{'title': 'Client Reference',
Expand Down
4 changes: 2 additions & 2 deletions bika/lims/browser/analysisrequest/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __call__(self):
if workflow.getInfoFor(ar, 'review_state') == 'invalid':
childar = hasattr(ar, 'getChildAnalysisRequest') \
and ar.getChildAnalysisRequest() or None
childid = childar and childar.getRequestID() or None
childid = childar and childar.getId() or None
message = _('This Analysis Request has been withdrawn and is shown '
'for trace-ability purposes only. Retest: '
'${retest_child_id}.',
Expand All @@ -35,7 +35,7 @@ def __call__(self):
'generated automatically due to '
'the retraction of the Analysis '
'Request ${retracted_request_id}.',
mapping={'retracted_request_id': safe_unicode(par.getRequestID())})
mapping={'retracted_request_id': safe_unicode(par.getId())})
self.context.plone_utils.addPortalMessage(
t(message), 'info')
template = LogView.__call__(self)
Expand Down
2 changes: 1 addition & 1 deletion bika/lims/browser/analysisrequest/manage_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __call__(self):
getPointOfCapture=poc,
sort_on='title',
show_categories=show_cats,
getAnalysisRequestUID=ar.UID())
getRequestUID=ar.UID())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, getRequestUID is used in AnalysesView as a content filter key-value: https://github.com/senaite/bika.lims/blob/senaite-integration/bika/lims/browser/analyses.py#L45
But there is no index getRequestUID in bika_analysis_catalog. Keep the old one getAnalysisRequestUID instead: https://github.com/senaite/bika.lims/blob/senaite-integration/bika/lims/catalog/analysis_catalog.py#L26

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note there is an index getRequestID though (note ID not UID): https://github.com/senaite/bika.lims/blob/senaite-integration/bika/lims/catalog/analysis_catalog.py#L36 .... ummm.... mental note for future @xispa we need to avoid missunderstandings here and better to only have two indexes with the same pattern getRequestUID + getRequestID instead of getAnalysisRequestUID + getRequestID .... confusing story

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forget about this... I've seen now you already changed the index names in catalog.

t.form_id = "ar_manage_results_%s" % poc
t.allow_edit = True
t.review_states[0]['transitions'] = [{'id': 'submit'},
Expand Down
7 changes: 3 additions & 4 deletions bika/lims/browser/analysisrequest/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ def get_mail_subject(self, ar):
css = []
blanks_found = False
if ai:
ais.append(ar.getRequestID())
ais.append(ar.getId())
if co:
if ar.getClientOrderNumber():
if not ar.getClientOrderNumber() in cos:
Expand Down Expand Up @@ -1183,7 +1183,6 @@ def _sampler_data(self, sample=None):
'home_phone': contact.getHomePhone() if contact else '',
'mobile_phone': contact.getMobilePhone() if contact else '',
'job_title': to_utf8(contact.getJobTitle()) if contact else '',
'department': to_utf8(contact.getDepartment()) if contact else '',
'physical_address': physical_address,
'postal_address': postal_address,
'home_page': to_utf8(mhomepage)}
Expand Down Expand Up @@ -1280,7 +1279,7 @@ def _analyses_data(self, ar, analysis_states=None):
showhidden = self.isHiddenAnalysesVisible()

catalog = get_tool(CATALOG_ANALYSIS_LISTING)
brains = catalog({'getAnalysisRequestUID': ar.UID(),
brains = catalog({'getRequestUID': ar.UID(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no index getRequestUID in bika_analysis_catalog. Keep the old one getAnalysisRequestUID instead: https://github.com/senaite/bika.lims/blob/senaite-integration/bika/lims/catalog/analysis_catalog.py#L26

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note there is an index getRequestID though (note ID not UID): https://github.com/senaite/bika.lims/blob/senaite-integration/bika/lims/catalog/analysis_catalog.py#L36 .... ummm.... mental note for future @xispa we need to avoid missunderstandings here and better to only have two indexes with the same pattern getRequestUID + getRequestID instead of getAnalysisRequestUID + getRequestID .... confusing story

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forget about this... I've seen now you already changed the index names in catalog.

'review_state': analysis_states,
'sort_on': 'sortable_title'})
for brain in brains:
Expand Down Expand Up @@ -1569,4 +1568,4 @@ def _format_address(address):
keys = ['address', 'city', 'district', 'state', 'zip', 'country']
addr = ''.join(["<span>%s</span>" % address.get(v) for v in keys
if address.get(v, None)])
return "<div class='address'>%s</div>" % addr
return "<div class='address'>%s</div>" % addr
4 changes: 2 additions & 2 deletions bika/lims/browser/analysisrequest/published_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __call__(self):
if workflow.getInfoFor(ar, 'review_state') == 'invalid':
childar = hasattr(ar, 'getChildAnalysisRequest') \
and ar.getChildAnalysisRequest() or None
childid = childar and childar.getRequestID() or None
childid = childar and childar.getId() or None
message = _('This Analysis Request has been withdrawn and is '
'shown for trace-ability purposes only. Retest: '
'${retest_child_id}.',
Expand All @@ -84,7 +84,7 @@ def __call__(self):
'generated automatically due to '
'the retraction of the Analysis '
'Request ${retracted_request_id}.',
mapping={'retracted_request_id': par.getRequestID()})
mapping={'retracted_request_id': par.getId()})
self.context.plone_utils.addPortalMessage(
self.context.translate(message), 'info')

Expand Down
4 changes: 2 additions & 2 deletions bika/lims/browser/analysisrequest/results_not_requested.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __call__(self):
if workflow.getInfoFor(ar, 'review_state') == 'invalid':
childar = hasattr(ar, 'getChildAnalysisRequest') \
and ar.getChildAnalysisRequest() or None
childid = childar and childar.getRequestID() or None
childid = childar and childar.getId() or None
message = _('This Analysis Request has been withdrawn and is shown '
'for trace-ability purposes only. Retest: ${retest_child_id}.',
mapping={"retest_child_id":childid if childid else ''})
Expand All @@ -46,7 +46,7 @@ def __call__(self):
message = _(
'This Analysis Request has been generated automatically due to '
'the retraction of the Analysis Request ${retracted_request_id}.',
mapping={"retracted_request_id": par.getRequestID()})
mapping={"retracted_request_id": par.getId()})
self.context.plone_utils.addPortalMessage(message, 'info')

can_do = getSecurityManager().checkPermission(ResultsNotRequested, ar)
Expand Down
12 changes: 6 additions & 6 deletions bika/lims/browser/analysisrequest/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __call__(self):
self.request,
getPointOfCapture=poc,
show_categories=self.context.bika_setup.getCategoriseAnalysisServices(),
getAnalysisRequestUID=self.context.UID())
getRequestUID=self.context.UID())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments above re getAnalysisRequestUID versus getRequestID indexes

t.allow_edit = True
t.form_id = "%s_analyses" % poc
t.review_states[0]['transitions'] = [{'id': 'submit'},
Expand Down Expand Up @@ -140,7 +140,7 @@ def __call__(self):
'listed here for trace-ability purposes. Please follow '
'the link to the retest')
if childar:
message = (message + " %s.") % childar.getRequestID()
message = (message + " %s.") % childar.getId()
else:
message = message + "."
self.addMessage(message, 'warning')
Expand All @@ -153,7 +153,7 @@ def __call__(self):
'generated automatically due to '
'the retraction of the Analysis '
'Request ${retracted_request_id}.',
mapping={'retracted_request_id': par.getRequestID()})
mapping={'retracted_request_id': par.getId()})
self.addMessage(message, 'info')
self.renderMessages()
return self.template()
Expand Down Expand Up @@ -314,7 +314,7 @@ def SelectedServices(self):
bac = getToolByName(self.context, 'bika_analysis_catalog')
res = []
for analysis in bac(portal_type="Analysis",
getRequestID=self.context.RequestID):
getRequestID=self.context.getId()):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!. Was this working before? (because self.context.RequestID)
You could also use getAnalysisRequestUID=self.context.UID()

analysis = analysis.getObject()
res.append([analysis.getPointOfCapture(),
analysis.getCategoryUID(),
Expand Down Expand Up @@ -458,7 +458,7 @@ def get_custom_fields(self):
if workflow.getInfoFor(ar, 'review_state') == 'invalid':
childar = hasattr(ar, 'getChildAnalysisRequest') \
and ar.getChildAnalysisRequest() or None
anchor = childar and ("<a href='%s'>%s</a>" % (childar.absolute_url(), childar.getRequestID())) or None
anchor = childar and ("<a href='%s'>%s</a>" % (childar.absolute_url(), childar.getId())) or None
if anchor:
custom['ChildAR'] = {
'title': t(_("AR for retested results")),
Expand All @@ -469,7 +469,7 @@ def get_custom_fields(self):
if hasattr(ar, 'getParentAnalysisRequest') \
and ar.getParentAnalysisRequest():
par = ar.getParentAnalysisRequest()
anchor = "<a href='%s'>%s</a>" % (par.absolute_url(), par.getRequestID())
anchor = "<a href='%s'>%s</a>" % (par.absolute_url(), par.getId())
custom['ParentAR'] = {
'title': t(_("Invalid AR retested")),
'value': anchor
Expand Down
8 changes: 4 additions & 4 deletions bika/lims/browser/analysisrequest/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def notify_ar_retract(self, ar, newar):
lab_address = "<br/>".join(laboratory.getPrintAddress())
mime_msg = MIMEMultipart('related')
mime_msg['Subject'] = t(_("Erroneus result publication from ${request_id}",
mapping={"request_id": ar.getRequestID()}))
mapping={"request_id": ar.getId()}))
mime_msg['From'] = formataddr(
(encode_header(laboratory.getName()),
laboratory.getEmailAddress()))
Expand All @@ -92,9 +92,9 @@ def notify_ar_retract(self, ar, newar):
to.append(formatted)
mime_msg['To'] = ','.join(to)
aranchor = "<a href='%s'>%s</a>" % (ar.absolute_url(),
ar.getRequestID())
ar.getId())
naranchor = "<a href='%s'>%s</a>" % (newar.absolute_url(),
newar.getRequestID())
newar.getId())
addremarks = ('addremarks' in self.request and ar.getRemarks()) and ("<br/><br/>" + _("Additional remarks:") +
"<br/>" + ar.getRemarks().split("===")[1].strip() +
"<br/><br/>") or ''
Expand Down Expand Up @@ -578,7 +578,7 @@ def workflow_action_retract_ar(self):
self.notify_ar_retract(ar, newar)

message = _('${items} invalidated.',
mapping={'items': ar.getRequestID()})
mapping={'items': ar.getId()})
self.context.plone_utils.addPortalMessage(message, 'warning')
self.request.response.redirect(newar.absolute_url())

Expand Down
Loading