On Tue, 2006-02-28 at 17:52 +0100, Lennart Regebro wrote:
> On 2/28/06, Reinhold Strobl <[EMAIL PROTECTED]> wrote:
> > Thanks for the reply. But how would you implement previously described task
> > with
> > the calculator?
> I would implement it as a view on whatever object I want to view it
> on. Which may even be "*", that is any object.
Here's a go at answering your problem. I gather you don't even need a
component as such - just a piece of code to perform a calculation. I
borrowed a technique from SchoolBell which may help. I think it may help
because it provides a way of performing any variety of python code
within a tal template without using python in the template. Any method
added to TFWSAPI can be accessed in tal with 'tfws:mymethod'. I've not
used XMLRPC calls with Zope so I'm not sure how it will translate. Good
<!-- gives all sorts of lovely custom TAL expressions -->
"""TALES function namespace for TFWS specific actions.
Borrowed from SchoolBell.
def __init__(self, context):
self.context = context
# as example
"""Check whether context is an authenticated principal.
Sample usage in a page template:
<div tal:define="user request/principal">
if not IPrincipal.providedBy(self.context):
raise TypeError("tfws:authenticated can only be applied"
" to a principal")
return not IUnauthenticatedPrincipal.providedBy(self.context)
authenticated = property(authenticated)
> Lennart Regebro, Nuxeo http://www.nuxeo.com/
> CPS Content Management http://www.cps-project.org/
> Zope3-users mailing list
Tree Fern Web Services (NZ) Ltd
Zope3-users mailing list