Skip to content

Commit

Permalink
Merge pull request #61 from plone/60-skin-scripts-removed
Browse files Browse the repository at this point in the history
Replaced usages of getObjSize with human_readable_size
  • Loading branch information
jensens authored Oct 5, 2018
2 parents 549fdc0 + 76a1185 commit b839691
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Products/CMFEditions/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@
<browser:page
for="*"
name="version_file_view"
class=".views.VersionView"
template="templates/version_file_view.pt"
permission="zope2.View"
/>

<browser:page
for="*"
name="version_image_view"
class=".views.VersionView"
template="templates/version_image_view.pt"
permission="zope2.View"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<metal:main fill-slot="main">
<tal:main-macro metal:define-macro="main"
tal:define="size_value context/get_size;
size_label python:size_value and context.getObjSize(context) or None;
size_label python:size_value and view.human_readable_size(size_value) or None;
content_type context/get_content_type|context/Format;
">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
&mdash;
<span i18n:translate="label_size">Size</span>:

<span tal:define="size python:here.getObjSize(here)"
<span tal:define="size python:view.human_readable_size(here.get_size())"
tal:content="size">
File size
</span>
Expand Down
7 changes: 7 additions & 0 deletions Products/CMFEditions/browser/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from Products.CMFEditions.utilities import isObjectChanged
from Products.CMFEditions.utilities import isObjectVersioned
from Products.CMFEditions.utilities import maybeSaveVersion
from Products.CMFPlone.utils import human_readable_size
from Products.statusmessages.interfaces import IStatusMessage

class UpdateVersionOnEditView(BrowserView):
Expand Down Expand Up @@ -86,3 +87,9 @@ def __call__(self):
tag = '<img src="%s/file_download_version?version_id=%s" %s' % \
(here_url, version_id, working_copy_tag[altPos:])
return tag


class VersionView(BrowserView):

def human_readable_size(self):
return human_readable_size
1 change: 1 addition & 0 deletions news/60.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replaced usages of getObjSize with human_readable_size.

0 comments on commit b839691

Please sign in to comment.