Commit e83c9860 authored by Jérome Perrin's avatar Jérome Perrin

CMFActivity: use pformat instead of repr in ZMI's Activities tab

This improves readability when activity_kw, args or kw are big.
parent 3f79e30e
......@@ -69,6 +69,7 @@ from Products.MailHost.MailHost import MailHostError
from zLOG import LOG, INFO, WARNING, ERROR
import warnings
from time import time
from pprint import pformat
try:
from Products.TimerService import getTimerService
......@@ -665,7 +666,7 @@ class ActivityTool (BaseTool):
] + list(BaseTool.manage_options))
security.declareProtected( CMFCorePermissions.ManagePortal , 'manageActivities' )
manageActivities = DTMLFile( 'dtml/manageActivities', globals() )
manageActivities = DTMLFile( 'dtml/manageActivities', globals(), pformat=pformat )
security.declareProtected( CMFCorePermissions.ManagePortal , 'manageActivitiesAdvanced' )
manageActivitiesAdvanced = DTMLFile( 'dtml/manageActivitiesAdvanced', globals() )
......
......@@ -69,17 +69,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
<td><code><a href="<dtml-var expr="REQUEST.physicalPathToURL(path)">"><dtml-var path></a></code></td>
<td><code><dtml-var method_id></code></td>
<td>
<dtml-if activity_kw><small><pre><dtml-var expr="_.repr(activity_kw)[1:-1]" html_quote></pre></small>
<dtml-if activity_kw><small><pre><dtml-var expr="pformat(activity_kw)" html_quote></pre></small>
<dtml-else>&nbsp;
</dtml-if>
</td>
<td>
<dtml-if args><small><pre><dtml-var expr="_.repr(_.list(args))[1:-1]" html_quote></pre></small>
<dtml-if args><small><pre><dtml-var expr="pformat(_.list(args))" html_quote></pre></small>
<dtml-else>&nbsp;
</dtml-if>
</td>
<td>
<dtml-if kw><small><pre><dtml-var expr="_.repr(kw)[1:-1]" html_quote></pre></small>
<dtml-if kw><small><pre><dtml-var expr="pformat(kw)" html_quote></pre></small>
<dtml-else>&nbsp;
</dtml-if>
</td>
......
  • This is a good change, thank you.

    Nevertheless, I think I should point out that relying on "large" activity arguments is a bad idea in general. What "large" means is of course fuzzy. As a rule of thumb I would recommend avoiding going over 10kB:

    • document path ? fine
    • list of 200 paths, possibly with a few small other values associated with each ? probably fine
    • same with 100k items ? bad
    • email body ? bad, store in ZODB and pass its path to the activity
    • document content ? bad, store in ZODB and pass its path to the activity
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