Re: [Zope-dev] PythonLibraries Product
On Wed, 2003-09-10 at 23:46, Evan Simpson wrote:
Tres Seaver wrote:
Actually, the restricted case is the one which has the real win; the "free-floating" library is pretty, but not semanticaally needed. An added argument: a ZPT with its own private library becomes, in effect, a Zope3 view component; adopting such beasts will ease migration to Zope3.
Agreed.
For the filesystem representation: what if we just have two files for templates with libraries: 'foo.html' and 'foo.html.py'?
Eh. I think filesytem representations should handle this sort of thing much more generally. Assuming that the Zope object's ID is 'foo.html', there should be a text file of that name (encoded with quote_plus, which makes no difference in this case), and a directory named 'foo.html,'. Inside of this directory, there would be a 'library.py' (in this particular case), along with files such as 'properties' and 'proxies'.
Hmm, I'm thinking about this for the CMF. In CMF 1.3.x, a template which has a cache manager, or a title, puts those values in a simple 'name=value'-formatted file, with extension '.properties'. Permission mappings go in a separate file, with extension '.security'. So, the filesystem-based template 'foo_view' might have as many as three files associated with it: - 'foo_view.pt' - 'foo_view.pt.properties' - 'foo_view.pt.security' CMF 1.4 unified the two files into a single, '.ini'-formatted one: - 'foo_view.pt' - 'foo_view.pt.metadata' It feels more natural to me just to add another file: - 'foo_view.pt.py' This is especially nice for many CMF skin templates (those which contain forms), because I can probably *remove* the separate template which serves as the "POST-target" for the form! Instead, such templates will post *to themselves*, and use the bound library to do the validation / updates. In this case, we go from: - 'foo_edit_form.pt' - 'foo_edit.py' to: - 'foo_edit_form.pt' - 'foo_edit_form.pt.py'
And there is yet another argument for the bound library: it shows how unnecessary, as well has how evil, that <script> tag hack is.
Yep :-)
Refactoring a "one-off" template-cum-library will be simple, too:
Cool!
I would vote for having the bound library's names inserted into the 'template' TALES namespace, BTW.
Tricky -- right now, that's just the template object itself. I'd just introduce a builtin 'library' variable, and probably dump the function names into the global namespace as well.
+1, then. Tres. -- =============================================================== Tres Seaver tseaver@zope.com Zope Corporation "Zope Dealers" http://www.zope.com
Tres Seaver wrote:
Hmm, I'm thinking about this for the CMF. In CMF 1.3.x, a template which has a cache manager, or a title, puts those values in a simple 'name=value'-formatted file, with extension '.properties'. Permission mappings go in a separate file, with extension '.security'.
I wish I had been more involved when these decisions were being made -- I dislike this scheme, because it is irregular and requires you to know what sort of object you're dealing with just to be able to tell which files go together. If it's always file + ','-dir, external tools can move, rename, delete, etc safely. Then there's the potential for name clashes. It's unlikely, but not *terribly* so, that a user would create a second object named 'foo_edit_form.pt.py'. Using quote_plus avoids filesystem character set issues, and makes the simple ',' postfix clash-proof. Oh, well. Cheers, Evan
participants (2)
-
Evan Simpson -
Tres Seaver