Re: [Zope3-Users] Standard Macros
Hassan Alirezaei schrieb: > Hi Marius > > thanks for the response. you are right that was a typo, > "views/standard_macros" is totaly wrong. > however, the problem still remains the same: > even > > > > > or > > > > > won't work. I get the same old error as my other post. > > Any Ideas are appriciated. and more importantly, do other people get the > same error as I get??? I would really appriciate if someone tried the > above code in a ZPTPage through ZMI and tell me the results... > > Thanks alot. > Hass same here, also with authenticated users from a PAU ZCML user are working Module zope.tales.expressions, line 217, in __call__ return self._eval(econtext) Module zope.tales.expressions, line 194, in _eval ob = self._subexprs[-1](econtext) Module zope.tales.expressions, line 124, in _eval ob = self._traverser(ob, element, econtext) Module zope.app.pagetemplate.engine, line 68, in __call__ request=request) Module zope.traversing.adapters, line 164, in traversePathElement return traversable.traverse(nm, further_path) - __traceback_info__: (Principal(u'test1'), 'title') Module zope.traversing.adapters, line 52, in traverse raise TraversalError(subject, name) - __traceback_info__: (Principal(u'test1'), 'title', []) TraversalError: (Principal(u'test1'), 'title') regards Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
RE: [Zope3-Users] Standard Macros
Hi Hassan > Subject: Re: [Zope3-Users] Standard Macros > > Thanks for the detailed response Roger. nice to know this alternative! > However what I and I think David wanted to know is the reason > why this kind of practice cannot be done through the ZMI by > entering for example > > > > > > > --- > for a ZPTPage source. Sorry, I don't know. I do not use the ZMI and local Page Templates. Regards Roger Ineichen _ END OF MESSAGE ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Standard Macros
> Any Ideas are appriciated. and more importantly, do other people get the > same error as I get??? I would really appriciate if someone tried the > above code in a ZPTPage through ZMI and tell me the results... Yup, I get same error about UnauthenticatedPrincipal and 'title'. Have you tried if this works when this code is in view? I wonder if UnauthenticatedPrincipal object has 'title' attribute when called from page template registered as view? -- Maciej Wisniowski ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Standard Macros
Hi Marius thanks for the response. you are right that was a typo, "views/standard_macros" is totaly wrong. however, the problem still remains the same: even or won't work. I get the same old error as my other post. Any Ideas are appriciated. and more importantly, do other people get the same error as I get??? I would really appriciate if someone tried the above code in a ZPTPage through ZMI and tell me the results... Thanks alot. Hass Marius Gedminas wrote: On Sat, Feb 10, 2007 at 09:50:55AM +0100, David Johnson wrote: Is there a way to use standard_macros in a ZPT Page added via the ZMI? In a page registered via ZCML the following METAL is okay, however in a ZPT Page I receive an error regarding a key error for "views". Any ideas? ZPT Pages are content objects. @@standard_macros is for ZMI views. Your wish to use a ZMI-specific macro in a content object is strange. You probably can access it with template/@@standard_macros/foo even from a ZPT Page. I think 'template' is in the namespace of every page template, and I think @@standard_macros is registered for everything. FWIW views/foo is an old-fashioned spelling of context/@@foo. Marius Gedminas ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Standard Macros
On Sat, Feb 10, 2007 at 09:50:55AM +0100, David Johnson wrote: > Is there a way to use standard_macros in a ZPT Page added via the > ZMI? In a page registered via ZCML the following METAL is okay, > however in a ZPT Page I receive an error regarding a key error for > "views". > > > > > > Any ideas? ZPT Pages are content objects. @@standard_macros is for ZMI views. Your wish to use a ZMI-specific macro in a content object is strange. You probably can access it with template/@@standard_macros/foo even from a ZPT Page. I think 'template' is in the namespace of every page template, and I think @@standard_macros is registered for everything. FWIW views/foo is an old-fashioned spelling of context/@@foo. Marius Gedminas -- Professionalism has no place in art, and hacking is art. Software Engineering might be science; but that's not what I do. I'm a hacker, not an engineer. -- jwz signature.asc Description: Digital signature ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Standard Macros
Thanks for the detailed response Roger. nice to know this alternative! However what I and I think David wanted to know is the reason why this kind of practice cannot be done through the ZMI by entering for example --- for a ZPTPage source. THE REAL ISSUE (in my case) is this. I have a site and I have PAU principals set. I want to allow these principals to build their own html pages through a ZMI interface (this is vital) but I don't want them to enter the whole html source every time. instead I want them to be able to use macros and viewlets that I have defined with ZCML mainly i want them to be able to use the main skin. what is the standard approach to this? many thanks, thanks you Roger Ineichen wrote: Hi David Subject: [Zope3-Users] Standard Macros Is there a way to use standard_macros in a ZPT Page added via the ZMI? In a page registered via ZCML the following METAL is okay, however in a ZPT Page I receive an error regarding a key error for "views". Any ideas? Why not use the z3c.macro pattern? I implemented some very handy base patterns which make the *macro as views and mapping* pattern obsolate. See: svn//svn.zope.org/repos/main/z3c.macro With z3c:macro, you can register macros like: http://namespaces.zope.org/z3c";> And use them like: Macros can get registered on context, view and layer which makes them very handy if you need to provide different macros for e.g. forms etc. There is a README.txt file in the package which explains it in more details. See also zcml.txt for configuration infos. And if you like, you can register a macro as a IViewlet within the z3c.macroviewlet package at: svn//svn.zope.org/repos/main/z3c.macroviewlet Macro as viewlet sample --- This allows you inline definitions of macros which is very uesfull if you like to design fully working XHTML/ZPT templates. (without to splitt everything into own templates). e.g. template.pt sample (see z3c.skin.pagelet) - The title And if it's not enough, you can take a look at z3c.pagelet if you need more skin simplification. btw The pagelet pattern was developed for split the template and python view class into own components. I allways like to say the template is the view and the python view class ist the controller if I need to make a mapping to the MVC pattern. Regards Roger Ineichen _ END OF MESSAGE Warm regards, David ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
RE: [Zope3-Users] Standard Macros
Hi David > Subject: [Zope3-Users] Standard Macros > > Is there a way to use standard_macros in a ZPT Page added via > the ZMI? In a page registered via ZCML the following METAL > is okay, however in a ZPT Page I receive an error regarding a > key error for "views". > > > > > > Any ideas? Why not use the z3c.macro pattern? I implemented some very handy base patterns which make the *macro as views and mapping* pattern obsolate. See: svn//svn.zope.org/repos/main/z3c.macro With z3c:macro, you can register macros like: http://namespaces.zope.org/z3c";> And use them like: Macros can get registered on context, view and layer which makes them very handy if you need to provide different macros for e.g. forms etc. There is a README.txt file in the package which explains it in more details. See also zcml.txt for configuration infos. And if you like, you can register a macro as a IViewlet within the z3c.macroviewlet package at: svn//svn.zope.org/repos/main/z3c.macroviewlet Macro as viewlet sample --- This allows you inline definitions of macros which is very uesfull if you like to design fully working XHTML/ZPT templates. (without to splitt everything into own templates). e.g. template.pt sample (see z3c.skin.pagelet) - The title And if it's not enough, you can take a look at z3c.pagelet if you need more skin simplification. btw The pagelet pattern was developed for split the template and python view class into own components. I allways like to say the template is the view and the python view class ist the controller if I need to make a mapping to the MVC pattern. Regards Roger Ineichen _ END OF MESSAGE > Warm regards, > David ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Standard Macros
The situation is very simple. I have a fresh instance of zope3. when I try to add a ZPT Page through ZMI and enter the following html for the source: bla bla bla No error will occur during the adding of the ZPT Page. However, when I try to view the ZPT Page as an "Unauthenticated User" or another PAU principal, I will get the error which I added the traceback to the end of my post. It basically complains that it cannot traverse to the 'title' attribute of the principal! Now, I don't get the error If I view the ZPT Page as a ZCML "Manager" . It is very easy to try it yourself and see the error! I would appreciate any help. thanks alot in advance. Hass Here is the traceback: File "/usr/local/Zope-3.3.0/lib/python/zope/tales/tales.py", line 704, in evaluateText text = self.evaluate(expr) File "/usr/local/Zope-3.3.0/lib/python/zope/tales/tales.py", line 696, in evaluate return expression(self) - /usr/local/Zope-3.3.0/lib/python/zope/app/rotterdam/template_tablelayout.pt - Line 50, Column 36 - Expression: - Names: {'args': (), 'container': , 'context': , 'default': , 'loop': {}, 'nothing': None, 'options': {}, 'repeat': {}, 'request': URL=http://192.168.1.2:8080/ZPTPage>, 'template': , 'usage': 0xb4ee2d6c>} File "/usr/local/Zope-3.3.0/lib/python/zope/tales/expressions.py", line 217, in __call__ return self._eval(econtext) File "/usr/local/Zope-3.3.0/lib/python/zope/tales/expressions.py", line 194, in _eval ob = self._subexprs[-1](econtext) File "/usr/local/Zope-3.3.0/lib/python/zope/tales/expressions.py", line 124, in _eval ob = self._traverser(ob, element, econtext) File "/usr/local/Zope-3.3.0/lib/python/zope/app/pagetemplate/engine.py", line 68, in __call__ request=request) File "/usr/local/Zope-3.3.0/lib/python/zope/traversing/adapters.py", line 164, in traversePathElement return traversable.traverse(nm, further_path) - __traceback_info__: (0xb6a42dac>, 'title') File "/usr/local/Zope-3.3.0/lib/python/zope/traversing/adapters.py", line 52, in traverse raise TraversalError(subject, name) - __traceback_info__: (0xb6a42dac>, 'title', []) TraversalError: (0xb6a42dac>, 'title') Maciej Wisniowski wrote: I have the same problem. I just know the problem is with the principal_info macro and it only occurs when one is logged in with a PAU principal (ZCML principals do fine as far as I remember). 'same problem' is not enough I think. What is the traceback etc? ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Standard Macros
> I have the same problem. I just know the problem is with the > principal_info macro and it only occurs when one is logged in with a PAU > principal (ZCML principals do fine as far as I remember). 'same problem' is not enough I think. What is the traceback etc? -- Maciej Wisniowski ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Standard Macros
> Any ideas? bla bla bla Take a look at: zope/app/basicskin/configure.zcml and you'll see how standard_macros view is registered. -- Maciej Wisniowski ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Standard Macros
I have the same problem. I just know the problem is with the principal_info macro and it only occurs when one is logged in with a PAU principal (ZCML principals do fine as far as I remember). Any ideas are appreciated! Hass David Johnson wrote: Is there a way to use standard_macros in a ZPT Page added via the ZMI? In a page registered via ZCML the following METAL is okay, however in a ZPT Page I receive an error regarding a key error for "views". Any ideas? Warm regards, David ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Standard Macros
Is there a way to use standard_macros in a ZPT Page added via the ZMI? In a page registered via ZCML the following METAL is okay, however in a ZPT Page I receive an error regarding a key error for "views". Any ideas? Warm regards, David ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users