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 html metal:use-macro=context/@@standard_macros/page /html or html metal:use-macro=template/@@standard_macros/page /html 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. html metal:use-macro=views/standard_macros/page /html 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
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. html metal:use-macro=views/standard_macros/page /html 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
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: html metal:use-macro=context/@@standard_macros/page div metal:fill-slot=bodybla bla bla/div /html 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: PathExpr standard:u'request/principal/title' - Names: {'args': (), 'container': zope.app.folder.folder.Folder object at 0xb6e3242c, 'context': zope.app.folder.folder.Folder object at 0xb6e3242c, 'default': object object at 0xb7d95568, 'loop': {}, 'nothing': None, 'options': {}, 'repeat': {}, 'request': zope.publisher.browser.BrowserRequest instance URL=http://192.168.1.2:8080/ZPTPage, 'template': zope.app.zptpage.zptpage.ZPTPage object at 0xb5365aac, 'usage': zope.pagetemplate.pagetemplate.TemplateUsage object at 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__: (zope.app.security.principalregistry.UnauthenticatedPrincipal object at 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__: (zope.app.security.principalregistry.UnauthenticatedPrincipal object at 0xb6a42dac, 'title', []) TraversalError: (zope.app.security.principalregistry.UnauthenticatedPrincipal object at 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] custom widgets (IDisplayWidget)
Hello Frank, Thanks for the help. right. it is basically based on your mpgsite.i18n. I think what you do(especially the I18NWidget) should be a part of standard zope. Thanks for the great package, I learned a lot from it. I downloaded the svn version a couple of days ago but because of the fb package (as you mentioned) which wasn't there I couldnt run it properly so I just borrowed some parts (basically just the widget) and somehow made it appear (just for the EDIT part not for the DISPLAY). I understand that you are using the namespace approach. well, It is possible to get the Dict form of the widget (for example {'en':'something','jp':'something else'} ) . so when one says span tal:content=context/something/span in the template, what appears is {'en':'something','jp':'something else'} I thought maybe by having a custom display format for the custom widget then we can just check for the preferred language and return the appropriate language version: namely something OR something else This way we don't need to change the page template at all. the problem is I cannot register a custom display format for the I18N widget. May be I am missing something, but even in the standard zope.app.form.browser it says view type=zope.publisher.interfaces.browser.IBrowserRequest for=zope.schema.interfaces.IURI provides=zope.app.form.interfaces.IDisplayWidget factory=.textwidgets.URIDisplayWidget permission=zope.Public / and in the .textwidgets.URIDisplayWidget it is apparently telling it to place the URI inside a/a tags but this is not the case when you display the URI widget using: span tal:content=context/someURI/span so the view is not processed at all Now, If the zope:view tag only registers another view for the widget then MAYBE the problem is how to activate that view i.e. set it as default view. I appreciate any help Frank. + if I can make the standard URI widget to appear in a/a tags then the same solution is valid for my problem I think. So maybe some zope3-developer guys can help as well. Thank you. Hass FB wrote: Hi, On Sat, Nov 25, 2006 at 04:17:24AM +0900, Hassan Alirezaei wrote: Hello guys, I have a custom widget and I cannot manage to have a custom way of displaying it after editing. as far as I know, I should be registering the view for form.interfaces.IDisplayWidget(for display) and form.interfaces.IInputWidget(for editing). I use the following zcml lines: zope:view type=zope.publisher.interfaces.browser.IBrowserRequest provides=zope.app.form.interfaces.IInputWidget for=..interfaces.II18N factory=.widgets.SimpleI18NInputWidget permission=zope.Public / zope:view type=zope.publisher.interfaces.browser.IBrowserRequest provides=zope.app.form.interfaces.IDisplayWidget for=..interfaces.II18N factory=.widgets.I18NSimpleDisplayWidget permission=zope.Public / This looks familiar :-) . I don't know, if you used my I18NSimpleDisplayWidget. If you do: I can't remember ever using this one - maybe it's not working as expected. In most cases, I needed those multilingual fields in page template which I used a tales-namespace-adapter for. I admit that mpgsite.i18n is a mess. I'm currently moving all the i18n-stuff into a different package (fb) which is much smaller than mpgsite. fb.i18n has some additional advantages: * a special class is used as i18n-container (not a dict anymore). This class knows how to extract language versions, does some other fancy stuff and behaves like a dict otherwise. * One language is marked as the reference language now * a dedicated class makes it easy to i.e. extract all i18n-objects from the *whole zodb* and make some poor guy translate them. * Documentation is in english * dependencies are clear: * fb.fields: for displaying fancy help in edit forms * fb.skin's header-viewletprovider which is easy providable by your own skin, too * fb.searchengines: for automatically presenting all language versions to user agents identified as search engines (I asked a google-guy: It's ok to do so). The fb-package is available via svn here: https://fbo.no-ip.org/svn/fbo/fb The package is not complete, yet. But it will be at the end of the next week. Regards, Frank ___ 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] custom widgets (IDisplayWidget)
Hi Kapil , Thanks for the reply. part of it depends not only registration of the custom display widget, but also how your rendering the display, ie. if your using formlib, just using a displayformbase should do it, if your using zope.app.form directly you'll might also need to specify that you want to specify IDisplayWidget as the type when rendering, ie. its hard to say without the other piece of this, namely how your rendering the form. I am not using formlib. I use just the normal auto-generated forms for schema using the following zcml : addform label=Add Paper(Conf) name=AddPaper.html schema=..interfaces.IPaper content_factory=..paper.Paper fields=something permission=paper.edit / page for=..interfaces.IPaper name=paper.html template=paper.pt permission=zope.Public menu=zmi_views title=Preview / and the schema itself is like this: class IPaper(IPublication): A conference paper something=I18N( title=usomething, description=uthe title of the paper in English, value_type=TextLine(title=uvalue) ) and then after adding the object I use the following line in my template file (paper.pt) to render it: span tal:content=context/somethingsome/span I register the I18N widget like this: zope:view type=zope.publisher.interfaces.browser.IBrowserRequest provides=zope.app.form.interfaces.IInputWidget for=..interfaces.II18N factory=.widgets.SimpleI18NInputWidget permission=zope.Public / zope:view type=zope.publisher.interfaces.browser.IBrowserRequest provides=zope.app.form.interfaces.IDisplayWidget for=..interfaces.II18N factory=.widgets.I18NSimpleDisplayWidget permission=zope.Public name=myview/ now, the I18N widget renders fine at the time of adding the object (the view for IInputWidget) but it the other view to IDisplayWidget which is for display time (the zpt tag) will not even call the __call__() method of the I18NSimpleDisplayWidget class which is confusing. Do I need to have some other kind of setting please help. thanks, Hass ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] custom widgets (IDisplayWidget)
FB wrote: Hi, On Sun, Nov 26, 2006 at 03:33:06AM +0900, Hassan Alirezaei wrote: [snip] Just one last question. if the template just uses str() then what does the following zcml do? it is in the standard zope3 distribution under the zope/app/form/browser/configure.zcml and I didn't notice any problem even when i removed it. Is it just some irrelevant piece Usually you don't need displaywidgets. But they're handy if you e.g. want to view an object's content knowing the schema interface without any template. The browser:schemadisplay zcml-directive does that. This sounds really cool. I am really unfamiliar with namespaces though. can you please tell me where in fb package (or mpgsite package) you define this namespace. mpgsite uses two rather big tales-ns-adapters (mpg, mpgi18n), defined in mpgsite.tales. fb's approach is more modular. The i18n-ns-adapter's logic is in fb.i18n.tales, the registration is done in fb/i18n/configure.zcml . How those adapters work and how to write them yourself is explained in Stephan Richter's book. Regards, Frank ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users Thank you very much Frank. This is basically what I need. Finally I got what I needed. I managed to make the namespace from fb to work with my settings. I think I will just use the convenient FB package from now on though. Thanks again! keep up the good work!!! regards Hass ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] custom widgets (IDisplayWidget)
Hello guys, I have a custom widget and I cannot manage to have a custom way of displaying it after editing. as far as I know, I should be registering the view for form.interfaces.IDisplayWidget(for display) and form.interfaces.IInputWidget(for editing). I use the following zcml lines: zope:view type=zope.publisher.interfaces.browser.IBrowserRequest provides=zope.app.form.interfaces.IInputWidget for=..interfaces.II18N factory=.widgets.SimpleI18NInputWidget permission=zope.Public / zope:view type=zope.publisher.interfaces.browser.IBrowserRequest provides=zope.app.form.interfaces.IDisplayWidget for=..interfaces.II18N factory=.widgets.I18NSimpleDisplayWidget permission=zope.Public / not the first statement is applied and I can get my custom-rendered widget at the time of editing or adding an object. but the display of the schema is not changed at all by the second zcml code. later, I notices that in zope.app.schema package, there are some default Display classes for zope3 default widgets like URI that apparently set the tell zope to display a URI widget inside a/a tags but It when I try URI it does not appear like that (it is treated exactly like textline widget... I am quite confused here... any thing I am missing??? Thanks a lot for any help Hass ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] object i18n
Sascha Ottolski wrote: Am Samstag, 11. November 2006 15:56 schrieb Hassan Alirezaei: But the real problem is when two users want to have different translations for the same english word. for example one user might define some-jp-equevalent for an english word but another user might want to have some-other-jp-equivalent for an english word... In the case of one translation domain setting an english word again will override the original meaning. but I want to let every user has his own translation for each word ... I thought of having a domain for every user but then thought maybe there is a more elegant (and easier) way to do this. Any help is very much appreciated. hass not exactly what you asked for, but the approach of http://zope3.mpg.de/cgi-bin/twiki/view/Zope/MpgSiteI18N might be one that could suit your needs. page is unfortunately in german language, though. the idea is to make the fields of content objects being able to carry an entry for several languages. hint: you may find the mpgsite sources at svn co https://svnserv.cbs.mpg.de/svn/edv/EDV/mpgsite, as explained on http://zope3.mpg.de/cgi-bin/twiki/view/Zope/MpgSiteInstallation hope it helps in a way. cheers, Sascha Thanks Sascha. It was very useful. Although I can't read a single word of German, but the code was talking for itself. We can have different translations for every object of a class by using only one translation domain. The idea is to have a very complicated Unique ID (per object) per every attribute(schema field) that will be the same ID used for translation. then different translations can be associated to that ID (en, ja, de etc.) . I think the mpgsite is taking this a step further by designing a translation domain for every schema field regardless of which object it is used in nice. Thank you very much for the idea. I think the I18N schema field could be included in the standard zope3 as well. am I right? Hass ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] object i18n
Hello zope3-users; I am having the following situation but I can't find an elegant solution for it. I am having users signing up in my system. They will enter their personal information(name, univ. major) in 2 (could be even more) languages which will be saved in a PersonalInfo object: And I need to switch between the user's say Japanese name and English name. for this matter I ask the user to enter names in both japanese and english and then programmatically update an existing ILocalTranslationDomain utility to register his japanese personal info with the english one. This works fine. But the real problem is when two users want to have different translations for the same english word. for example one user might define some-jp-equevalent for an english word but another user might want to have some-other-jp-equivalent for an english word... In the case of one translation domain setting an english word again will override the original meaning. but I want to let every user has his own translation for each word ... I thought of having a domain for every user but then thought maybe there is a more elegant (and easier) way to do this. Any help is very much appreciated. hass ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zpt pages though ZMI
Hassan Alirezaei wrote: In my own skin I'm using span tal:replace=request/principal/titleUser/span with no problem for either zcml principals nor pau principals. Thanks Darryl, I got it working. span did the trick! I thought It did work Darryl But I had a small mistake in the template so the whole request/principal/title was not even parsed. Now that I fix it again with: span tal:replace=request/principal/titleUser/span it still doesn't work. when I print the Principal object itself (request/principal) i get security proxied zope.app.security.principalregistry.Principal instance at 0xb669fccc for the zope.manager and security proxied zope.app.authentication.principalfolder.Principal instance at 0xb596d22c for the PAU manager which is different as expectedly different of course. * once again to the original problem, when I upload the following ZPT page through the ZMI, -- html metal:use-macro=context/@@standard_macros/page /html I get the following error when viewing it while logged in with a PAU principal: File /usr/local/Zope-3.3.0c1/lib/python/zope/tales/expressions.py, line 217, in __call__ return self._eval(econtext) File /usr/local/Zope-3.3.0c1/lib/python/zope/tales/expressions.py, line 194, in _eval ob = self._subexprs[-1](econtext) File /usr/local/Zope-3.3.0c1/lib/python/zope/tales/expressions.py, line 124, in _eval ob = self._traverser(ob, element, econtext) File /usr/local/Zope-3.3.0c1/lib/python/zope/app/pagetemplate/engine.py, line 68, in __call__ request=request) File /usr/local/Zope-3.3.0c1/lib/python/zope/traversing/adapters.py, line 164, in traversePathElement return traversable.traverse(nm, further_path) - __traceback_info__: (Principal(u'isi.mas.hassy'), 'title') File /usr/local/Zope-3.3.0c1/lib/python/zope/traversing/adapters.py, line 52, in traverse raise TraversalError(subject, name) - __traceback_info__: (Principal(u'isi.mas.hassy'), 'title', []) TraversalError: (Principal(u'isi.mas.hassy'), 'title') --- here is how I refer to the request/principal/title : --- div id=userDetails metal:define-slot=user_details metal:block define-macro=logged_user span tal:omit-tag= i18n:translate=User:/span span replace=request/principal/titleUser/span /metal:block metal:block define-slot=login_logout metal:macro define-macro=login_logout tal:block content=structure context/@@login_logout / /metal:macro /metal:block /div - usingspan replace=request/principal/titleUser/span will work quite fine on every normal page I have and I can get the title for all the principals (ZCML and PAU) but when I upload the ZPT and look at it, ONLY ZCML users render without any problem. unauthenticated user in the ZCML also can not render. Thank you again for any help. Regards, Hassan ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] zpt pages though ZMI
Hello everyone, Does anyone know the easiest way to let people (principals of a site) develop their own pages with no knowledge about zop3 structure? AFAIK The users need to make their own pages with HTML (more generally ZPT) and upload them as a ZPT page. I dont want my whole website skin to disappear so I use the context/@@standard_macros/page for the zpt page. when I add it, the page renders fine for the Manager(ZCML) but not for other principals, apparently the title for each principal can not be traversed. this is my zpt page which I upload through the ZMI as Manager: html metal:use-macro=context/@@standard_macros/page /html and here is the error: --- File /usr/local/Zope-3.3.0c1/lib/python/zope/tales/tales.py, line 696, in evaluate return expression(self) - /home/hassan/HOMEPAGE2/modules/ISI/skin/template_tablelayout.pt - Line 59, Column 36 - Expression: PathExpr standard:u'request/principal/title' - Names: {'args': (), 'container': zope.app.folder.folder.Folder object at 0xb50880ac, 'context': zope.app.folder.folder.Folder object at 0xb50880ac, 'default': object object at 0xb7d44550, 'loop': {}, 'nothing': None, 'options': {}, 'repeat': {}, 'request': zope.publisher.browser.BrowserRequest instance URL=http://124.102.91.194:8080/ZPTPage, 'template': zope.app.zptpage.zptpage.ZPTPage object at 0xb50885ec, 'usage': zope.pagetemplate.pagetemplate.TemplateUsage object at 0xb503654c} File /usr/local/Zope-3.3.0c1/lib/python/zope/tales/expressions.py, line 217, in __call__ return self._eval(econtext) File /usr/local/Zope-3.3.0c1/lib/python/zope/tales/expressions.py, line 194, in _eval ob = self._subexprs[-1](econtext) File /usr/local/Zope-3.3.0c1/lib/python/zope/tales/expressions.py, line 124, in _eval ob = self._traverser(ob, element, econtext) File /usr/local/Zope-3.3.0c1/lib/python/zope/app/pagetemplate/engine.py, line 68, in __call__ request=request) File /usr/local/Zope-3.3.0c1/lib/python/zope/traversing/adapters.py, line 164, in traversePathElement return traversable.traverse(nm, further_path) - __traceback_info__: (zope.app.security.principalregistry.UnauthenticatedPrincipal object at 0xb7390b6c, 'title') File /usr/local/Zope-3.3.0c1/lib/python/zope/traversing/adapters.py, line 52, in traverse raise TraversalError(subject, name) - __traceback_info__: (zope.app.security.principalregistry.UnauthenticatedPrincipal object at 0xb7390b6c, 'title', []) TraversalError: (zope.app.security.principalregistry.UnauthenticatedPrincipal object at 0xb7390b6c, 'title') --- Not is this the expected behavior or am I doing something wrong??? thanks for any help. Hass ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zpt pages though ZMI
Hi again Darryl, just to check something real quick, does Boston skin really check for authenticated principals??? I checked the main template and it looks like Boston is getting the request/principal/title in the same way as every other skin: div id=userDetails metal:define-slot=user_details metal:block define-macro=logged_user span tal:omit-tag= i18n:translate=User:/span tal:block replace=request/principal/titleUser/tal:block /metal:block metal:block define-slot=login_logout metal:macro define-macro=login_logout tal:block content=structure context/@@login_logout / /metal:macro /metal:block /div I could render the page with a ZCML principal but not a PAU principal. is it at all possible to do that? I think it is but I just don't can't the grip to it. any gurus out there??? :) regards,Hass Hassan Alirezaei wrote: Thanks Darryl you were right about the title attribute of unauthenticated principals. they don't have it. I made another ZCML principal with a title and it works fine. The problem still remains the same though for the principals in the PAU. I always thought they do have a title bacause it is shown on ordinary pages when you login. ( well unauthenticated principals also show up :) ) I checked it with Boston skin. The principal title gets rendered but there is again another problem with some econtext.view that messes everything up again. I will try to figure that out or just borrow the request/principal/title part from boston skin and hang with my own skin which I like better. Thanks again Darryl Cousins wrote: Hi, Your problem is in /home/hassan/HOMEPAGE2/modules/ISI/skin/template_tablelayout.pt and UnauthenticatedPrincipal does not have attribute 'title'. Check Boston skin template which first tests for authenticated user before calling request/principal/title. Regards, Darryl On Sun, 2006-09-24 at 19:43 +0900, Hassan Alirezaei wrote: Hello everyone, Does anyone know the easiest way to let people (principals of a site) develop their own pages with no knowledge about zop3 structure? AFAIK The users need to make their own pages with HTML (more generally ZPT) and upload them as a ZPT page. I dont want my whole website skin to disappear so I use the context/@@standard_macros/page for the zpt page. when I add it, the page renders fine for the Manager(ZCML) but not for other principals, apparently the title for each principal can not be traversed. this is my zpt page which I upload through the ZMI as Manager: html metal:use-macro=context/@@standard_macros/page /html and here is the error: --- File /usr/local/Zope-3.3.0c1/lib/python/zope/tales/tales.py, line 696, in evaluate return expression(self) - /home/hassan/HOMEPAGE2/modules/ISI/skin/template_tablelayout.pt - Line 59, Column 36 - Expression: PathExpr standard:u'request/principal/title' - Names: {'args': (), 'container': zope.app.folder.folder.Folder object at 0xb50880ac, 'context': zope.app.folder.folder.Folder object at 0xb50880ac, 'default': object object at 0xb7d44550, 'loop': {}, 'nothing': None, 'options': {}, 'repeat': {}, 'request': zope.publisher.browser.BrowserRequest instance URL=http://124.102.91.194:8080/ZPTPage, 'template': zope.app.zptpage.zptpage.ZPTPage object at 0xb50885ec, 'usage': zope.pagetemplate.pagetemplate.TemplateUsage object at 0xb503654c} File /usr/local/Zope-3.3.0c1/lib/python/zope/tales/expressions.py, line 217, in __call__ return self._eval(econtext) File /usr/local/Zope-3.3.0c1/lib/python/zope/tales/expressions.py, line 194, in _eval ob = self._subexprs[-1](econtext) File /usr/local/Zope-3.3.0c1/lib/python/zope/tales/expressions.py, line 124, in _eval ob = self._traverser(ob, element, econtext) File /usr/local/Zope-3.3.0c1/lib/python/zope/app/pagetemplate/engine.py, line 68, in __call__ request=request) File /usr/local/Zope-3.3.0c1/lib/python/zope/traversing/adapters.py, line 164, in traversePathElement return traversable.traverse(nm, further_path) - __traceback_info__: (zope.app.security.principalregistry.UnauthenticatedPrincipal object at 0xb7390b6c, 'title') File /usr/local/Zope-3.3.0c1/lib/python/zope/traversing/adapters.py, line 52, in traverse raise TraversalError(subject, name) - __traceback_info__: (zope.app.security.principalregistry.UnauthenticatedPrincipal object at 0xb7390b6c, 'title', []) TraversalError
[Zope3-Users] assigning roles to principals on AuthenticatedPrincipalCreated event
Hello zope3-users, I am trying to do make easy user registrations for my website. but I am having problems assigning roles to the principals automatically. the question is WHEN should I assign these roles to the new principals? which is the standard procedure? right now I am doing : 1. User accounts (InternalPrincipal) are created. 2. The first time the user logs in a role with id=isi.member will be assigned to it on the whole site so the user receives membership permissions. *configure.zcml* subscriber handler=.userhome.UserLoggedIn for=zope.app.authentication.interfaces.IAuthenticatedPrincipalCreated / *userhome.py class UserLoggedIn(object): def __init__(self, event): userAnno=zapi.getUtility(IPrincipalAnnotationUtility, 'ISIUserAnnotation') annotations=userAnno.getAnnotations(event.principal) if annotations.get('user_home') is None: print ***RGISTERING ANNOTATIONS* annotations['user_home'] = Folder() annotations['user_home']['register'] = PersistentDict() annotations['user_home']['personal'] = Person() annotations['user_home']['personal'].first='hassan' annotations['user_home']['personal'].last='alirezaei' annotations['user_home']['testing'] = TESTING THE NEW USER siteroot=getSite() prm=IPrincipalRoleManager(siteroot) print **for %s *** %siteroot prm.assignRoleToPrincipal('isi.member', event.principal) ** getSite() gives me ISI.isi.isi.isi object at 0xb659eb2c but when i go to this object (my main site root) and change to Grant from zmi_actions menu the role is still unset for the user. any help is highly appreciated. it is very much possible I am doing the hard way to perform the task. Thank you in advance! Hass ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] principal annotation alternative?
hello guys. I have been trying to make a homepage that users can register and have their own pages which they can change their settings. I also want these setting to be adjustable by the site owner as well. I hear that I can not use Principal Annotations anymore because principals are not persistent in the new versions. I have been using ZOPE 3.2.1 . could anyone please explain me the general Idea in short how this is possible. If there are any links to sample codes that would be even greater. I just want to know what I need and how I should put them together. Hass ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users