-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relation to zpt-fragments? #1
Comments
I finally released Martin's zpt-fragments as its own add-on https://pypi.python.org/pypi/collective.themefragments It should work with all p.a.theming releases, but a bug in p.a.theming prevents previewing the fragments. Also, I released a hobby project for embedding GS install (and unistall) profiles with themes https://pypi.python.org/pypi/collective.themesitesetup Unfortunately, there has been regression in p.a.theming plugin support and this requires a fix for most p.a.theming versions to be released. |
That's very interesting !
Combining the fragment approach with Diazo content manipulation would be extremely powerful. |
@ebrehault Cool, although, I believe that idea of zpt-fragments was to cover most of those use-cases (already years ago, when Martin made the original and rejected pull for p.a.theming). That aside, I'm preparing to add support for restricted python scripts into collective.themefragments and I would appreciate your comments on it. In the current implementation collective/collective.themefragments@75c194b If you have fragment
you can have method
and call it in fragments/navbar.pt like
So, I'd prefer the old style "one script per function/method" and pass them context instead of adding multiple funtions into one script. Currently I only pass the view to the method as "self", but probably I should pass at least also context and container to make it more like the legacy PythonScripts. Does that make sense or did you have some specific reason for planning to support multiple functions in a single file? Also, I'm not sure if namespacing scripts makes any sense, or view/foobar-lookup simply look for all the scripts in theme's fragments-directory. |
Well the main reason is it is easier if we allow users to put many functions in the same file. def clean_up_data(data):
return blabla
def do_something():
return clean_up_data(something)
def do_something_else():
return clean_up_data(something_else) As @djay mentionned, I have already implemented a secured Python script runner based on And just to let you know, I plan to move rapido into the theming editor (just like you did for fragment, we would create a folder |
Eric BREHAULT wrote:
But that's something completely new when compared to legacy Zope scripts But I now finally understand that c.ttw and c.themefragments approach So, it seems, I should keep c.themefragments separate from c.ttw. We've I'll see, if I can get c.themefragments' script support to be similar |
I think it is fine to have 2 separated approaches here, as we are still investigating, it will enrich our insight on the problem, and we might merge later (if accurate). |
I don't see any advantage in maintaining similarity with zmi Python And I defiantly agree that not requiring a zpt is a good idea. Ideally you
|
Dylan Jay wrote:
It's the only existing (and therefore familiar) alternative for full I can agree, why class based views are better, but don't know yet, how Also, extra boilerblate for imports, class definition and function
It was not yet clear, how to reach templates from Python, so I stayed I can understand the reasoning in going all XSLT in templating, but I |
@ebrehault Just checking, are you aware of Martin's proposed zpt-fragments-feature for plone.app.theming? The original pull to merge it was rejected, but we have been using it with success and and I've been keeping it compatible with the 1.2.x branch (Plone 4.3.x.).
It adds support for in-theme "fragments" folder, which is published via @@theme-fragment traversal view (with the current context). Looks similar to ideas in your README.
It is only for ZPTs, but I see no reason, why it could not be extended to also support restricted python scripts.
The text was updated successfully, but these errors were encountered: