You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
there is also anoher approach: we keep PlominoUtils functions, and we just add a new one like that:
from zope.globalrequest import getRequest
def findContext():
"""Find the context
"""
request = getRequest()
published = request.get('PUBLISHED', None)
context = getattr(published, '__parent__', None)
if context is None:
context = request.PARENTS[0]
return context
(I saw that as I was trying to solve a bug in plone.app.theming, I didn't knew the getRequest method, maybe it could be helpful with PlominoAgent.run_async)
In order to allow utility methods to access
context
, they need to live on a persistent tool.The version of PlominoUtils on the https://github.com/plomino/Plomino/tree/plominoutils_tool branch requires that.
From Eric:
compileFormulaScript
would get the tool, so instead of inserting:it would do:
Note that after this change, existing formulas would need to be recompiled (deleted from
scripts
). This could be done in a migration step.The text was updated successfully, but these errors were encountered: