Discussion:
pickleable zcml actions...
Chris McDonough
2008-08-22 15:01:17 UTC
Permalink
Hi Malthe et. al.,

The current release of z3c.pt does, e.g., this in its expression.py:

class PythonTranslation(ExpressionTranslation):
def validate(self, string):
"""We use the ``parser`` module to determine if
an expression is a valid python expression."""

parser.expr(string.encode('utf-8'))

def translate(self, string):
if isinstance(string, unicode):
string = string.encode('utf-8')

return types.value(string)

PythonTranslation = PythonTranslation()

Because we replace the classname with an instance, the ZCML "actions"
that are generated when z3c.pt's onfigure.zcml is included cannot be
pickled. This isn't really much of a problem for z2/z3, because lots
of its stuff can't be pickled, so it doesn't even try, but for bfg,
I'd like to keep the actions pickleable so it can potentially start
faster when there are lots of views.

Would anyone mind if I changed it to:

python_translation = PythonTranslation()

.. and made the according changes to imports and usages?

- C


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "z3c.pt" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to z3c_pt+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/z3c_pt?hl=en
-~----------~----~----~----~------~----~------~--~---
Malthe Borch
2008-08-22 15:04:20 UTC
Permalink
Post by Chris McDonough
python_translation = PythonTranslation()
.. and made the according changes to imports and usages?
That's fine; flexibility is good.

\malthe

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "z3c.pt" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to z3c_pt+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/z3c_pt?hl=en
-~----------~----~----~----~------~----~------~--~---
Chris McDonough
2008-08-22 15:18:57 UTC
Permalink
OK, great, done.

- C
Post by Malthe Borch
Post by Chris McDonough
python_translation = PythonTranslation()
.. and made the according changes to imports and usages?
That's fine; flexibility is good.
\malthe
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "z3c.pt" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to z3c_pt+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/z3c_pt?hl=en
-~----------~----~----~----~------~----~------~--~---

Loading...