Roundup Tracker - Issues

Issue 1081981

classification
Possibly incorrect description of "extensions" API
Type: Severity: normal
Components: Database Versions:
process
Status: closed fixed
:
: : mstarzyk, richard
Priority: normal :

Created on 2004-12-09 10:13 by mstarzyk, last changed 2004-12-09 21:41 by richard.

Messages
msg1549 Author: [hidden] (mstarzyk) Date: 2004-12-09 10:13
In "Customizing Roundup/Adding a time log to your 
issues" - point 4:

The function "totalTimeSpent" in this example takes 
one argument, but I think it will be called with two - 
with an instance of TemplatingUtils as the first 
argument, and then the original argument from the 
example code.

I did't run this code, but have a similar situation.
This is a part of an "extension" script (Taken from 
wiki LinkFormattingExample and converted to 0.8.0 
following the said example):
...
def localReplace(*args):
    print "ARGS:", args
    message = args[1]
    return CustomTags().replace(message)

def init(tracker):
    tracker.registerUtil('localReplace', localReplace)

This extension is then used in the page like this:

<pre tal:content="structure python:utils.
localReplace(msg.content.hyperlinked())">content</
pre> 

And it prints on the console:

ARGS: (
 <roundup.cgi.templating.TemplatingUtils instance 
at 0x0105FA30>, 
 'This is a change note.'
)

So I guess the signature of the original function in 
the example should be:
  def totalTimeSpent(utils, times):
while now it is:
  def totalTimeSpent(times):
msg1550 Author: [hidden] (richard) Date: 2004-12-09 21:41
Logged In: YES 
user_id=6405

Actually, it's the API that's wrong - the utils argument shouldn't 
be there. 
History
Date User Action Args
2004-12-09 10:13:42mstarzykcreate