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.

Hi Reinhold,

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

Best regards,

  <!-- gives all sorts of lovely custom TAL expressions -->

class TFWSAPI(object):
    """TALES function namespace for TFWS specific actions.

    Borrowed from SchoolBell.

    implements(IPathAdapter, ITALESFunctionNamespace)

    def __init__(self, context):
        self.context = context

# as example
    def authenticated(self):
        """Check whether context is an authenticated principal.

        Sample usage in a page template:

            <div tal:define="user request/principal">
            <span tal:condition="user/tfws:authenticated"
              User title
            <span tal:condition="not:user/tfws:authenticated">

        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
> Zope3-users@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
Darryl Cousins
Tree Fern Web Services (NZ) Ltd

Zope3-users mailing list

Reply via email to