Commit ce04fd8b authored by Ivan Tyagov's avatar Ivan Tyagov

Use respective Permissions constant rather than hard coded string.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37106 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e1ac9ed1
...@@ -183,7 +183,7 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -183,7 +183,7 @@ class Image(TextConvertableMixin, File, OFSImage):
# Photo display methods # Photo display methods
# #
security.declareProtected('View', 'tag') security.declareProtected(Permissions.View, 'tag')
def tag(self, display=None, height=None, width=None, cookie=0, def tag(self, display=None, height=None, width=None, cookie=0,
alt=None, css_class=None, format=None, quality=DEFAULT_QUALITY, alt=None, css_class=None, format=None, quality=DEFAULT_QUALITY,
resolution=None, frame=None, **kw): resolution=None, frame=None, **kw):
...@@ -243,7 +243,7 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -243,7 +243,7 @@ class Image(TextConvertableMixin, File, OFSImage):
def __str__(self): def __str__(self):
return self.tag() return self.tag()
security.declareProtected('Access contents information', 'displayIds') security.declareProtected(Permissions.AccessContentsInformation, 'displayIds')
def displayIds(self, exclude=('thumbnail',)): def displayIds(self, exclude=('thumbnail',)):
"""Return list of display Ids.""" """Return list of display Ids."""
id_list = list(DEFAULT_DISPLAY_ID_LIST) id_list = list(DEFAULT_DISPLAY_ID_LIST)
...@@ -259,7 +259,7 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -259,7 +259,7 @@ class Image(TextConvertableMixin, File, OFSImage):
id_list.sort(key=getSurfaceArea) id_list.sort(key=getSurfaceArea)
return id_list return id_list
security.declareProtected('Access contents information', 'displayLinks') security.declareProtected(Permissions.AccessContentsInformation, 'displayLinks')
def displayLinks(self, exclude=('thumbnail',)): def displayLinks(self, exclude=('thumbnail',)):
"""Return list of HTML <a> tags for displays.""" """Return list of HTML <a> tags for displays."""
links = [] links = []
...@@ -267,7 +267,7 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -267,7 +267,7 @@ class Image(TextConvertableMixin, File, OFSImage):
links.append('<a href="%s?display=%s">%s</a>' % (self.REQUEST['URL'], display, display)) links.append('<a href="%s?display=%s">%s</a>' % (self.REQUEST['URL'], display, display))
return links return links
security.declareProtected('Access contents information', 'displayMap') security.declareProtected(Permissions.AccessContentsInformation, 'displayMap')
def displayMap(self, exclude=None, format=None, quality=DEFAULT_QUALITY,\ def displayMap(self, exclude=None, format=None, quality=DEFAULT_QUALITY,\
resolution=None): resolution=None):
"""Return list of displays with size info.""" """Return list of displays with size info."""
...@@ -345,7 +345,7 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -345,7 +345,7 @@ class Image(TextConvertableMixin, File, OFSImage):
return mime, image.data return mime, image.data
# Display # Display
security.declareProtected('View', 'index_html') security.declareProtected(Permissions.View, 'index_html')
@fill_args_from_request('display', 'quality', 'resolution', 'frame') @fill_args_from_request('display', 'quality', 'resolution', 'frame')
def index_html(self, REQUEST, *args, **kw): def index_html(self, REQUEST, *args, **kw):
"""Return the image data.""" """Return the image data."""
...@@ -445,7 +445,7 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -445,7 +445,7 @@ class Image(TextConvertableMixin, File, OFSImage):
"""At least see if it *might* be valid.""" """At least see if it *might* be valid."""
return self.getWidth() and self.getHeight() and self.getData() and self.getContentType() return self.getWidth() and self.getHeight() and self.getData() and self.getContentType()
security.declareProtected('View', 'getSizeFromImageDisplay') security.declareProtected(Permissions.View, 'getSizeFromImageDisplay')
def getSizeFromImageDisplay(self, image_display): def getSizeFromImageDisplay(self, image_display):
"""Return the size for this image display, """Return the size for this image display,
or dimension of this image. or dimension of this image.
...@@ -470,4 +470,3 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -470,4 +470,3 @@ class Image(TextConvertableMixin, File, OFSImage):
""" """
File.PUT(self, REQUEST, RESPONSE) File.PUT(self, REQUEST, RESPONSE)
self._update_image_info() self._update_image_info()
...@@ -153,7 +153,7 @@ class PDFDocument(Image): ...@@ -153,7 +153,7 @@ class PDFDocument(Image):
text += result text += result
return text return text
security.declareProtected('View', 'getSizeFromImageDisplay') security.declareProtected(Permissions.View, 'getSizeFromImageDisplay')
def getSizeFromImageDisplay(self, image_display): def getSizeFromImageDisplay(self, image_display):
""" """
Return the size for this image display, or None if this image display name Return the size for this image display, or None if this image display name
......
...@@ -155,7 +155,7 @@ class OOoDocument(PermanentURLMixIn, BaseConvertableFileMixin, File, ...@@ -155,7 +155,7 @@ class OOoDocument(PermanentURLMixIn, BaseConvertableFileMixin, File,
rx_strip = re.compile('<[^>]*?>', re.DOTALL|re.MULTILINE) rx_strip = re.compile('<[^>]*?>', re.DOTALL|re.MULTILINE)
rx_compr = re.compile('\s+') rx_compr = re.compile('\s+')
security.declareProtected('View', 'index_html') security.declareProtected(Permissions.View, 'index_html')
@fill_args_from_request('display', 'quality', 'resolution') @fill_args_from_request('display', 'quality', 'resolution')
def index_html(self, REQUEST, *args, **kw): def index_html(self, REQUEST, *args, **kw):
"""Return the document data.""" """Return the document data."""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment