On Monday 11 June 2007 10:26:35 Chris G wrote:
# def cb_prepare(args): request = args["request"] data = request.getData() data["statcatslinks"] = PyblStatcats(request)
What I'm not clear about is the last line, PyblStatcats is a class. As I understand it 'PyblStatcats(request)' creates an instance of PyblStatcats and runs its __init__ method, so far so good. But what does 'PyblStatcats(request)' return? It would appear to be a string as it's used to set the value in the data dictionary. However I can't find anywhere in the Python documentation that tells me about this (implicit?) return value.
If PyblStatcats is a class, then calling it must return an instance of PyblStatcats. If you include a return statement in a class's __init__ method, it can only return None, anything else raises an exception.
Are you sure that this call is returning a string? Might it be returning an object which has an explicit __str__ method? What does
py> data["statcatslinks"].__class__
say?
Cheers, Richard