-
-
Notifications
You must be signed in to change notification settings - Fork 152
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
Issue-383: Click on some analyses pops up a new page instead of object log #454
Conversation
@xispa: Please only look at the third commit, the rest is only formatting and PEP8'ing |
@@ -87,7 +87,7 @@ | |||
tal:condition="filename" | |||
tal:define="file method/MethodDocument; | |||
filename python:getattr(file, 'filename', ''); | |||
filesize python:file.getObjSize(); | |||
filesize python:file.get_size() or 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've checked getObjSize()
from Products.CMFPlone.CatalogTool
and the function already delegates the action to get_size
:
def getObjSize(obj):
""" Helper method for catalog based folder contents.
"""
smaller = SIZE_ORDER[-1]
if base_hasattr(obj, 'get_size'):
size = obj.get_size()
else:
size = 0
...
Also, as per the following log that appears in the traceback, I am not sure this change would be enough:
Unauthorized: The object is marked as private. Access to 'get_size' of (plone.app.blob.field.BlobWrapper object at 0x10ce0f938) denied.
I am missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plone.app.blob.field.BlobWrapper
defines this:
@security.private
def get_size(self):
""" return the size of the blob """
blob = openBlob(self.blob)
size = fstat(blob.fileno()).st_size
blob.close()
return size
Afaik this means that it is not accessible from a template or script context.
So if you analyze this part of the traceback, it makes sense:
Module script, line 17, in getObjSize
- <FSPythonScript at /bikalims/methods/method-5/getObjSize>
- Line 17
Description of the issue/feature this PR addresses
Linked issue: #383
Current behavior before PR
Clicking on an Analysis where the method has an attached document raises an Unauthorized Error
Desired behavior after PR is merged
Analysis Info is displayed properly
--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.