[Zope3-Users] Question about menu.py
Hi, I am trying to use zope3 menu in grok. I have a question about the getMenuItems function in the file menu.py ( zope.app.publisher/trunk/src/zope/app/publisher/browser/menu.py). My comprehension of the function is: it tries to collect all the adapters of 'object' and 'request' providing the interface returned by self.getMenuItemType(). When I look to the getMenuItemType() function, it returns a utility ( return zope.component.getUtility(IMenuItemType, self.id)) and the consequence is that the adapter lookup returns nothing in getMenuItems. Is that a bug or I -surely- have missed something ? Thanks for your explanation Simon Elbaz ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] test writing with z3c.testsetup
Hi, I have some difficulties to run tests with z3c.testsetup. Running cdcadama/bin/test yields this output: bash-3.00$ cdcadama/bin/test -vvv Running tests at level 1 Running unit tests: Running: /home/simon/.buildout/eggs/z3c.testsetup-0.2.1-py2.4.egg/z3c/testsetup/basicsetup.txt (0.140 s) /home/simon/.buildout/eggs/z3c.testsetup-0.2.1-py2.4.egg/z3c/testsetup/functionaldoctestsetup.txt (0.052 s) /home/simon/.buildout/eggs/z3c.testsetup-0.2.1-py2.4.egg/z3c/testsetup/pythontestsetup.txt (0.041 s) /home/simon/.buildout/eggs/z3c.testsetup-0.2.1-py2.4.egg/z3c/testsetup/unitdoctestsetup.txt (0.010 s) /home/simon/.buildout/eggs/z3c.testsetup-0.2.1-py2.4.egg/z3c/testsetup/util.txt (0.003 s) /home/simon/.buildout/eggs/z3c.testsetup-0.2.1-py2.4.egg/z3c/testsetup/unittestsetup.txt (0.010 s) /home/simon/.buildout/eggs/z3c.testsetup-0.2.1-py2.4.egg/z3c/testsetup/testrunner.txt (2.007 s) /home/simon/.buildout/eggs/z3c.testsetup-0.2.1-py2.4.egg/z3c/testsetup/README.txt (0.154 s) /home/simon/.buildout/eggs/z3c.testsetup-0.2.1-py2.4.egg/z3c/testsetup/testgetter.txt (0.170 s) Ran 173 tests with 0 failures and 0 errors in 2.593 seconds. I don't understand why it does not take the tests written under cdcadama/src/cdcadama/tests/customer/ directory. In this directory, I have put 2 files along with __init__.py: bash-3.00$ more doctest01.txt testsetup01.py :: doctest01.txt :: doctest = :doctest: This is a simple doctest. 1+1 2 :: testsetup01.py :: import z3c.testsetup test_suite = z3c.testsetup.register_all_tests('cdcadama.tests.customer') What should I do to have these files processed by the testrunner ? Thanks for your help Simon ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Working with the last version of a module
Hi, I need to use z3c.form and the last downloadable release is 1.9.0 in the python package index. However, I would like to use the last version of z3c.form (trunk revision in svn.zope.org). How I could do that ? Thanks for your help Simon ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Executing code a server startup
Hi, I am trying to execute some code at zope3 server startup. Zope3 posts hint using a IProcessStartingEvent subscriber in configure.zcml. Here is an extract of configure.zcml: subscriber handler=cdcadama.authentication.onStartup for=zope.app.appsetup.interfaces.IProcessStartingEvent / and the handler definition: def onStartup(event): print 'hello' The problem is that the function is not called at server startup. But when a call to notify(zope.app.appsetup.interfaces.ProcessStarting()) is made later in the code (after the server starts), it prints 'hello'. It looks like that the subscriber is registered after the server notifies the event. Thanks for your help Simon ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Executing code a server startup
It is now better: the event DatabaseOpened is caught at startup. However, it is surprising that ProcessStartingEvent is not caught. Simon On Mon, May 18, 2009 at 6:46 AM, Andreas Jung li...@zopyx.com wrote: On 18.05.09 00:42, Simon Elbaz wrote: Hi, I am trying to execute some code at zope3 server startup. Zope3 posts hint using a IProcessStartingEvent subscriber in configure.zcml. Here is an extract of configure.zcml: subscriber handler=cdcadama.authentication.onStartup for=zope.app.appsetup.interfaces.IProcessStartingEvent / and the handler definition: def onStartup(event): print 'hello' The problem is that the function is not called at server startup. But when a call to notify(zope.app.appsetup.interfaces.ProcessStarting()) is made later in the code (after the server starts), it prints 'hello'. Isn't there a DatabaseOpened event? -aj ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] z3c.form: Setting HTTP_AUTHORIZATION in header
Hi, I would like to setup authentication in an application using HTTPBasicAuthCredentialsPlugin. For that, I need to set HTTP_AUTHORIZATION environment variable. How could I do that from within the add z3c.form method for example? Thanks for your help Simon ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] z3c.form: Setting HTTP_AUTHORIZATION in header
Hi, I have finally understood HTTP authentication process: a zope.View permission is set on a page in order to trigger the Unauthorized exception. My new difficulty is how to catch this exception : Unauthorized: (zope.app.publisher.browser.viewmeta.LoginAddForm object at 0x922a16c, 'browserDefault', 'zope.View') Thanks for your help Simon* * On Tue, May 26, 2009 at 12:22 AM, Simon Elbaz elbazsim...@gmail.com wrote: Hi, I would like to setup authentication in an application using HTTPBasicAuthCredentialsPlugin. For that, I need to set HTTP_AUTHORIZATION environment variable. How could I do that from within the add z3c.form method for example? Thanks for your help Simon ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Paste sending 'Authentication Required' popup
Hi, I am trying to set a session credentials plugins in an application. A request on 'http://localhost:8080/' sends me to the login form as defined in the plugin. Whereas, a request on 'http://localhost:9030/++skin++Login/@@search.html' triggers the 'Authentication Required' popup (realm Zope). I have tried to debug with pdb and here are the lines just before the popup appears: (Pdb) r /home/simon/.buildout/eggs/zope.app.wsgi-3.5.2-py2.5.egg/zope/app/wsgi/__init__.py(58)__call__() - response = request.response (Pdb) r --Return-- /home/simon/.buildout/eggs/zope.app.wsgi-3.5.2-py2.5.egg/zope/app/wsgi/__init__.py(71)__call__()-('',) - return response.consumeBodyIter() (Pdb) r /home/simon/.buildout/eggs/Paste-1.7.2-py2.5.egg/paste/httpserver.py(289)wsgi_execute() - try: (Pdb) r --Return-- /home/simon/.buildout/eggs/Paste-1.7.2-py2.5.egg/paste/httpserver.py(297)wsgi_execute()-None - result = None browser/configure.zcml page name=search.html for=zope.app.folder.interfaces.IFolder permission=cdcadama.View layer=cdcadama.layer.ICdcadamaBrowserLayer class=.login.SearchAddForm / Could someone tell me how to inhibate the HTTPBasicAuth popup ? Thanks Simon ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Paste sending 'Authentication Required' popup
Finally, I found where HTTPBasicAuthentication is triggered. It is in: /home/simon/.buildout/eggs/zope.app.wsgi-3.5.2-py2.5.egg/zope/app/wsgi/__init__.py(57)__call__() - request = publish(request, handle_errors=handle_errors) /home/simon/.buildout/eggs/zope.publisher-3.8.0-py2.5.egg/zope/publisher/publish.py(142)publish() - obj, request, sys.exc_info(), True) /home/simon/.buildout/eggs/zope.app.publication-3.7.0-py2.5.egg/zope/app/publication/zopepublication.py(336)handleException() - body = mapply(view, (), request) /home/simon/.buildout/eggs/zope.publisher-3.8.0-py2.5.egg/zope/publisher/publish.py(108)mapply() - return debug_call(obj, args) /home/simon/.buildout/eggs/zope.publisher-3.8.0-py2.5.egg/zope/publisher/publish.py(114)debug_call() - return obj(*args) * /home/simon/.buildout/eggs/zope.app.http-3.6.0-py2.5.egg/zope/app/http/exception/unauthorized.py(32)__call__() - self.request.unauthorized('basic realm=Zope') * I wonder how zope gets into this piece of code and don't use ./zope.app.exception-3.5.0-py2.5.egg/zope/app/exception/browser/unauthorized.py Thanks for your help Simon On Thu, Jun 11, 2009 at 4:48 PM, Simon Elbaz elbazsim...@gmail.com wrote: Hi, I am trying to set a session credentials plugins in an application. A request on 'http://localhost:8080/' sends me to the login form as defined in the plugin. Whereas, a request on 'http://localhost:9030/++skin++Login/@@search.html' triggers the 'Authentication Required' popup (realm Zope). I have tried to debug with pdb and here are the lines just before the popup appears: (Pdb) r /home/simon/.buildout/eggs/zope.app.wsgi-3.5.2-py2.5.egg/zope/app/wsgi/__init__.py(58)__call__() - response = request.response (Pdb) r --Return-- /home/simon/.buildout/eggs/zope.app.wsgi-3.5.2-py2.5.egg/zope/app/wsgi/__init__.py(71)__call__()-('',) - return response.consumeBodyIter() (Pdb) r /home/simon/.buildout/eggs/Paste-1.7.2-py2.5.egg/paste/httpserver.py(289)wsgi_execute() - try: (Pdb) r --Return-- /home/simon/.buildout/eggs/Paste-1.7.2-py2.5.egg/paste/httpserver.py(297)wsgi_execute()-None - result = None browser/configure.zcml page name=search.html for=zope.app.folder.interfaces.IFolder permission=cdcadama.View layer=cdcadama.layer.ICdcadamaBrowserLayer class=.login.SearchAddForm / Could someone tell me how to inhibate the HTTPBasicAuth popup ? Thanks Simon ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Unauthorized object not the same
Hi, I am trying to set a SessionCredentialsPlugin in a application. When I try to access the following URL http://localhost:9030/++skin++Login/@@search.html, the result of the call: /home/simon/.buildout/eggs/zope.app.publication-3.7.0-py2.5.egg/zope/app/publication/zopepublication.py(322)handleException() - view = zope.component.queryMultiAdapter( (exception, request), name=name) (Pdb) print view.__init__ bound method Unauthorized.__init__ of *zope.app.http.exception.unauthorized.Unauthorized *object at 0x97faa6c where exception=(zope.app.publisher.browser.viewmeta.Contents object at 0x89ad5ec, 'browserDefault', 'zope.View') When I try to access the following URL http://localhost:9030/, the result of the call: /home/simon/.buildout/eggs/zope.app.publication-3.7.0-py2.5.egg/zope/app/publication/zopepublication.py(322)handleException() - view = zope.component.queryMultiAdapter((exception, request), name=name) (Pdb) print view.__init__ bound method Unauthorized.__init__ of * zope.app.publisher.browser.viewmeta.Unauthorized* object at 0x8badd6c where exception is (zope.app.publisher.browser.viewmeta.SearchAddForm object at 0x89ad3ec, 'browserDefault', 'cdcadama.View'). Could someone explain me why the result is different ? Thanks Simon ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Unauthorized object not the same
Hi, I have added : include package=zope.app.exception.browser / in the file browser/configure.zcml and the result is the same. I have identified the function that makes the difference, it is: /home/simon/.buildout/eggs/zope.interface-3.5.1-py2.5-linux-i686.egg/zope/interface/adapter.py(478)queryMultiAdapter() - factory = self.lookup(map(providedBy, objects), provided, name) where (Pdb) print objects (Unauthorized(zope.app.publisher.browser.viewmeta.SearchAddForm object at 0x9b503cc, 'browserDefault', 'zope.View'), zope.publisher.browser.BrowserRequest instance URL= http://localhost:9030/++skin++Login/@@search.html) (Pdb) print provided InterfaceClass zope.interface.Interface (Pdb) print name index.html I am a little bit stuck ... Regards Simon On Sun, Jun 14, 2009 at 1:27 AM, Simon Elbaz elbazsim...@gmail.com wrote: Hi, I am trying to set a SessionCredentialsPlugin in a application. When I try to access the following URL http://localhost:9030/++skin++Login/@@search.html, the result of the call: /home/simon/.buildout/eggs/zope.app.publication-3.7.0-py2.5.egg/zope/app/publication/zopepublication.py(322)handleException() - view = zope.component.queryMultiAdapter( (exception, request), name=name) (Pdb) print view.__init__ bound method Unauthorized.__init__ of *zope.app.http.exception.unauthorized.Unauthorized *object at 0x97faa6c where exception=(zope.app.publisher.browser.viewmeta.Contents object at 0x89ad5ec, 'browserDefault', 'zope.View') When I try to access the following URL http://localhost:9030/, the result of the call: /home/simon/.buildout/eggs/zope.app.publication-3.7.0-py2.5.egg/zope/app/publication/zopepublication.py(322)handleException() - view = zope.component.queryMultiAdapter((exception, request), name=name) (Pdb) print view.__init__ bound method Unauthorized.__init__ of * zope.app.publisher.browser.viewmeta.Unauthorized* object at 0x8badd6c where exception is (zope.app.publisher.browser.viewmeta.SearchAddForm object at 0x89ad3ec, 'browserDefault', 'cdcadama.View'). Could someone explain me why the result is different ? Thanks Simon ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Unauthorized object not the same
Hi finally, I understood my mistake. I was accessing the search.html page through a z3c.layer.pagelet.IPageletBrowserLayer (following P. Carduner's tutorial) without including in configure.zcml: include package=z3c.pagelet file=meta.zcml / include package=z3c.pagelet / include package=z3c.layer.pagelet / include package=zope.contentprovider / The z3c unauthorized view is defined in: z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/browser/__init__.py. I needed also to define a layout template for the unauthorized view. So, I added the following in browser/configure.zcml: z3c:layout for=* layer=cdcadama.layer.ICdcadamaBrowserLayer template=unauthorized.pt / where unauthorized.pt is a copy of z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/browser/unauthorized.pt. And for the moment, it seems ok. Regards, Simon On Mon, Jun 15, 2009 at 6:02 PM, Simon Elbaz elbazsim...@gmail.com wrote: Hi, I have added : include package=zope.app.exception.browser / in the file browser/configure.zcml and the result is the same. I have identified the function that makes the difference, it is: /home/simon/.buildout/eggs/zope.interface-3.5.1-py2.5-linux-i686.egg/zope/interface/adapter.py(478)queryMultiAdapter() - factory = self.lookup(map(providedBy, objects), provided, name) where (Pdb) print objects (Unauthorized(zope.app.publisher.browser.viewmeta.SearchAddForm object at 0x9b503cc, 'browserDefault', 'zope.View'), zope.publisher.browser.BrowserRequest instance URL= http://localhost:9030/++skin++Login/@@search.html) (Pdb) print provided InterfaceClass zope.interface.Interface (Pdb) print name index.html I am a little bit stuck ... Regards Simon On Sun, Jun 14, 2009 at 1:27 AM, Simon Elbaz elbazsim...@gmail.comwrote: Hi, I am trying to set a SessionCredentialsPlugin in a application. When I try to access the following URL http://localhost:9030/++skin++Login/@@search.html, the result of the call: /home/simon/.buildout/eggs/zope.app.publication-3.7.0-py2.5.egg/zope/app/publication/zopepublication.py(322)handleException() - view = zope.component.queryMultiAdapter( (exception, request), name=name) (Pdb) print view.__init__ bound method Unauthorized.__init__ of *zope.app.http.exception.unauthorized.Unauthorized *object at 0x97faa6c where exception=(zope.app.publisher.browser.viewmeta.Contents object at 0x89ad5ec, 'browserDefault', 'zope.View') When I try to access the following URL http://localhost:9030/, the result of the call: /home/simon/.buildout/eggs/zope.app.publication-3.7.0-py2.5.egg/zope/app/publication/zopepublication.py(322)handleException() - view = zope.component.queryMultiAdapter((exception, request), name=name) (Pdb) print view.__init__ bound method Unauthorized.__init__ of * zope.app.publisher.browser.viewmeta.Unauthorized* object at 0x8badd6c where exception is (zope.app.publisher.browser.viewmeta.SearchAddForm object at 0x89ad3ec, 'browserDefault', 'cdcadama.View'). Could someone explain me why the result is different ? Thanks Simon ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Using homefolder in a TALES expression
Hi, I'm trying to reproduce the example given in zope.app.homefolder/trunk/src/zope/app/homefolder/README.txt and I have some difficulties to understand. The error traceback seems to say that principal cannot be traversed to the homefolder. The used template test_homefolder.pt looks like: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head titlePageletTestLayout/title /head body p tal:content=request/principal/homefolder /p /body /html In configure.zcml: z3c:pagelet name=search_display.html for=zope.app.folder.interfaces.IFolder permission=adama.site_access layer=z3c.layer.pagelet.IPageletBrowserLayer class=.login.SearchAddForm / z3c:layout for=.login.SearchAddForm layer=z3c.layer.pagelet.IPageletBrowserLayer template=test_homefolder.pt / Traceback: File /home/simon/.buildout/eggs/zope.tales-3.4.0-py2.5.egg/zope/tales/tales.py, line 696, in evaluate return expression(self) - /home/simon/ADAMA/Src/gui/z3c_auth/src/z3c_auth/browser/ test_homefolder.pt - Line 10, Column 0 - Expression: PathExpr standard:u'request/principal/homefolder' - Names: {'args': (), 'context': zope.site.folder.Folder object at 0x90da9ec, 'default': object object at 0xb7ded728, 'loop': {}, 'nothing': None, 'options': {}, 'repeat': {}, 'request': zope.publisher.browser.BrowserRequest instance URL= http://localhost:9060/++skin++PageletTestSkin/mysite/@@search.html, 'template': z3c.ptcompat.ViewPageTemplateFile object at 0x97ab42c, 'view': zope.app.publisher.browser.viewmeta.SearchAddForm object at 0x9c2566c, 'views': zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object at 0x9c25dec} File /home/simon/.buildout/eggs/zope.tales-3.4.0-py2.5.egg/zope/tales/expressions.py, line 217, in __call__ return self._eval(econtext) File /home/simon/.buildout/eggs/zope.tales-3.4.0-py2.5.egg/zope/tales/expressions.py, line 194, in _eval ob = self._subexprs[-1](econtext) File /home/simon/.buildout/eggs/zope.tales-3.4.0-py2.5.egg/zope/tales/expressions.py, line 124, in _eval ob = self._traverser(ob, element, econtext) File /home/simon/.buildout/eggs/zope.pagetemplate-3.5.0-py2.5.egg/zope/pagetemplate/engine.py, line 68, in __call__ request=request) File /home/simon/.buildout/eggs/zope.traversing-3.7.1-py2.5.egg/zope/traversing/adapters.py, line 139, in traversePathElement return traversable.traverse(nm, further_path) - __traceback_info__: (Principal(u'users.a'), 'homefolder') File /home/simon/.buildout/eggs/zope.traversing-3.7.1-py2.5.egg/zope/traversing/adapters.py, line 53, in traverse raise LocationError(subject, name) - __traceback_info__: (Principal(u'users.a'), 'homefolder', []) LocationError: (Principal(u'users.a'), 'homefolder') Thanks for any help Simon ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] z3c.traverser and stackinfo
That was the problem ! :) Thx a lot Simon Dan Korostelev wrote: 2009/10/21 Simon Elbaz simon.el...@free.fr: I am trying to use stackinfo module from z3c.traverser and don't understand the following error because ITraversalStackInfo should adapt BrowserRequest class according to (http://svn.zope.org/z3c.traverser/trunk/src/z3c/traverser/stackinfo/consumer.py?rev=95983view=auto): TypeError: ('Could not adapt', zope.publisher.browser.BrowserRequest instance URL=http://localhost:9060/++skin++Adama/mysite/@@stackinfo.html, InterfaceClass z3c.traverser.stackinfo.interfaces.ITraversalStackInfo) Did you not include z3c.traverser.stackinfo configure.zcml file? ___ Zope3-users mailing list Zope3-users@zope.org https://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] How to modify the action value in a form
Hi, I access a z3c.form with the following url: http://localhost:9060/++skin++Adama/mysite/kv/object_portfolio/OBJ_REF1/hf A stack consumer (from z3c.traverser.stackinfo.consumer) consumes the arguments kv/object_portfolio/OBJ_REF1. Finally, in the rendered form, I get: div id=contentform action=http://localhost:9060/++skin++Adama/mysite/hf/index.html; method=post enctype=multipart/form-data class=edit-form name=form id=form So when the form is submitted, it is submitted to the following URL (which does not exist): http://localhost:9060/++skin++Adama/mysite/hf/index.html How can I modify the action value in order to get: div id=contentform action=http://localhost:9060/++skin++Adama/mysite/kv/object_portfolio/OBJ_REF1/hf/index.html; method=post enctype=multipart/form-data class=edit-form name=form id=form Thx Simon ___ Zope3-users mailing list Zope3-users@zope.org https://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] LoginPassword error
Hi, I've been quietly working with zope3 until I recently launched a buildout. Now, the following error occurs when trying to access the ZMI. Thanks for your help Simon 2010-01-11T14:11:15 ERROR SiteError http://localhost:9060/@@login.html Traceback (most recent call last): File /home/simon/.buildout/eggs/zope.publisher-3.12.0-py2.5.egg/zope/publisher/publish.py, line 134, in publish result = publication.callObject(request, obj) File /home/simon/.buildout/eggs/zope.app.publication-3.10.2-py2.5.egg/zope/app/publication/zopepublication.py, line 205, in callObject return mapply(ob, request.getPositionalArguments(), request) File /home/simon/.buildout/eggs/zope.publisher-3.12.0-py2.5.egg/zope/publisher/publish.py, line 109, in mapply return debug_call(obj, args) - __traceback_info__: bound method HTTPAuthenticationLogin.login of zope.browserpage.metaconfigure.HTTPAuthenticationLogin object at 0x8b50f0c File /home/simon/.buildout/eggs/zope.publisher-3.12.0-py2.5.egg/zope/publisher/publish.py, line 115, in debug_call return obj(*args) File /home/simon/.buildout/eggs/zope.app.security-3.7.5-py2.5.egg/zope/app/security/browser/auth.py, line 64, in login self.request.principal.id, self.request) File /home/simon/.buildout/eggs/zope.principalregistry-3.7.0-py2.5.egg/zope/principalregistry/principalregistry.py, line 82, in unauthorized a = ILoginPassword(request) TypeError: ('Could not adapt', zope.publisher.browser.BrowserRequest instance URL=http://localhost:9060/@@login.html, InterfaceClass zope.authentication.interfaces.ILoginPassword) ___ Zope3-users mailing list Zope3-users@zope.org https://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] LoginPassword error
After adding zope.login to configure.zcml, all is fine. Thanks Baiju. Baiju M wrote: On Mon, Jan 11, 2010 at 6:45 PM, Simon Elbaz simon.el...@free.fr wrote: Hi, I've been quietly working with zope3 until I recently launched a buildout. Now, the following error occurs when trying to access the ZMI. I can see that you are using 2.12.0 version of zope.publisher which has some changes related to authentication: http://pypi.python.org/pypi/zope.publisher#id1 From CHANGES.txt: Reverted change done in 3.6.2. The zope.authentication dependency has been removed again. The BasicAuthAdapter and FTPAuth adapters are now found in the new zope.login package. So, it looks like you need to include zope.login as dependency and it's ZCML. BTW, do you pin your versions in version.cfg ? This might be useful: http://wiki.zope.org/bluebream/PinningVersionsInBuildout Regards, Baiju M ___ Zope3-users mailing list Zope3-users@zope.org https://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] z3c.formjs widgetselector customization
Hi all, I use z3c.formjs in a project and would like to customize the selector id used into jsaction.handler for form field. Why ? because the z3c.formui templates add -row suffix to the widget id and I need also to add the -row suffix to the selector id in the event handler. I have attached a patch for the jsaction.py file that use the default WidgetSelector class if no IWidgetSelector component is locally registered. If it is a good idea, how could I apply it to svn repository ? regards, Simon jsaction.py.patch Description: Binary data ___ Zope3-users mailing list Zope3-users@zope.org https://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Referencing objects
Hi, here is what I have understood in zope3 security policy: On Mon, Feb 21, 2011 at 1:28 PM, Michael Seifert michael.seif...@gmx.netwrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Am 04.02.2011 17:04, schrieb Thierry Florac: Hi, Le vendredi 4 février 2011, Michael Seifert michael.seif...@gmx.net a écrit : == Hello everyone, I recently started a Zope3 project, but I am stuck at the very beginning. Although I have some experience with Zope2, the more flexible approach to developing web applications was giving me a really hard start. Let me point out my situation: I created a container hierarchy which is stored in ZODB. Say I have a set of object types A, B, C, D, whose relationships look like the following (edges represent containment, i.e. A contains B,... where B and D are in subcontainers of A): A / \ B D | C C has an attribute referencing an object of type D. As this attribute is mandatory on creation, I created a vocabulary, which ascends the hierarchy from the current context until it reaches A and returns all objects of type D. Now the part that doesn't work: While ascending from C to B and from B to A works fine, descending from A to D returns a security proxied object and since these objects cannot be pickled, I cannot store it's reference in the attribute of C. 1. Is this the way it's meant to be done? :) What is your opinion of storing B and D objects in subcontainers of A? That shouldn't be a problem, it's not different when you use a basic folder-like container which, internally, stores sub-objects in an internal b-tree container ; the only difference here is that you own two internal containment attributes. 2. Are there any means to turn the vocabulary into trusted code, so it will not be encapsulated in a proxy (without deactivating the security proxy)? Perhaps can you use the removeSecurityProxy function ? 3. How do you reference objects like you do with foreign keys in relational databases? I want to do this to prevent objects from being saved multiple times. If the targetted object is persistent (and so a subclass of Persistent class), it should be stored only once in the database (just try to alter properties of an object and check if the other one is also modified or not to check !) Another way I commonly use to store references is to store only an IIntIds utility reference, which is an integer ; the benefit of this is that this value can easilly be indexed. Regards, Thierry Thanks Thierry, your answer helped a lot. I solved the issue with: from zope.security.proxy import removeSecurityProxy def vocab(context): ... return SimpleVocabulary.fromValues([removeSecurityProxy(elem) for elem in context.values()])) Still, I have some questions regarding the security. 1. When creating the vocabulary with return SimpleVocabulary.fromValues([elem.someFunc() for elem in context.values()])) I noticed that elem in context.values() are not proxied yet, so the actual wrapping must take place before the values are passed to the ZMI. How does calling the removeSecurityProxy function prevent the objects from being wrapped, since the wrapping takes place AFTER the function call? (I had a look at the sources, but the implementation resides in zope.security._proxy which is a binary .so file) The removeSecurityProxy does not prevent the object from being proxied: it allows the storage of the object in an attribute without its proxy. The original object will always be proxied. 2. The vocabularies are registered as utilities in the .zcml file(s). Since access to objects from these vocabularies is not checked by a security proxy: Is it therefore possible that any user can access the vocabulary data? If so, is there a way to restrict access to the utility vocabularies? You can use the utility permission attribute. Regards, Michael -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.17 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk1iWlAACgkQnzX+Jf4GTUxO2gCeIoKh8l+6QaGsDo07WKUT2Y94 BDQAn16rtkPVIIPo5N8a2K7A/SsOdoQU =dHUQ -END PGP SIGNATURE- ___ Zope3-users mailing list Zope3-users@zope.org https://mail.zope.org/mailman/listinfo/zope3-users Regards, Simon ___ Zope3-users mailing list Zope3-users@zope.org https://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] core dump with zope.interface and zope.security
Hi, A developement zope server crashes with a segmentation fault on a unix server. I am trying to figure out how the error happens. If someone has already encountered the same error, thanks for any advices ... Here is the stack of the core: #0 0x0dfe8108 in PyDict_GetItem () from /usr/local/lib/libpython2.7.so.0.0 (gdb) where #0 0x0dfe8108 in PyDict_GetItem () from /usr/local/lib/libpython2.7.so.0.0 #1 0x0e004a67 in _PyType_Lookup () from /usr/local/lib/libpython2.7.so.0.0 #2 0x0e005173 in lookup_maybe () from /usr/local/lib/libpython2.7.so.0.0 #3 0x0e006e11 in call_method () from /usr/local/lib/libpython2.7.so.0.0 #4 0x0e007c4d in slot_mp_ass_subscript () from /usr/local/lib/libpython2.7.so.0.0 #5 0x03892b50 in check () from /home/simon/ADAMA/Src/gui/z3c_dunning/eggs/zope.security-4.0.0b1-py2.7-openbsd-5.3-i386.egg/zope/security/_proxy.so #6 0x0389477f in proxy_getattro () from /home/simon/ADAMA/Src/gui/z3c_dunning/eggs/zope.security-4.0.0b1-py2.7-openbsd-5.3-i386.egg/zope/security/_proxy.so #7 0x0dfece60 in PyObject_GetAttr () from /usr/local/lib/libpython2.7.so.0.0 #8 0x05994dff in providedBy () from /home/simon/ADAMA/Src/gui/z3c_dunning/eggs/zope.interface-4.0.5-py2.7-openbsd-5.3-i386.egg/zope/interface/_zope_interface_coptimizations.so #9 0x0dfeaa32 in PyCFunction_Call () from /usr/local/lib/libpython2.7.so.0.0 #10 0x0dfacebc in PyObject_Call () from /usr/local/lib/libpython2.7.so.0.0 #11 0x0e041434 in PyEval_CallObjectWithKeywords () from /usr/local/lib/libpython2.7.so.0.0 #12 0x0e03eae0 in builtin_map () from /usr/local/lib/libpython2.7.so.0.0 #13 0x0dfeaa96 in PyCFunction_Call () from /usr/local/lib/libpython2.7.so.0.0 #14 0x0e046dda in PyEval_EvalFrameEx () from /usr/local/lib/libpython2.7.so.0.0 #15 0x0e048ccb in PyEval_EvalCodeEx () from /usr/local/lib/libpython2.7.so.0.0 #16 0x0e0471c1 in PyEval_EvalFrameEx () from /usr/local/lib/libpython2.7.so.0.0 #17 0x0e048ccb in PyEval_EvalCodeEx () from /usr/local/lib/libpython2.7.so.0.0 #18 0x0e0471c1 in PyEval_EvalFrameEx () from /usr/local/lib/libpython2.7.so.0.0 Simon ___ Zope3-users mailing list Zope3-users@zope.org https://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] label customisation
Hi, In the z3c.form.AddForm, zope.schema.List field is rendered with Add/Delete buttons. How to customize those labels ? My code does not have any effect: AddAction = button.StaticButtonActionAttribute( u'Add Action', button=multi.MultiWidget.buttons['add'], form=StepAddForm) Thanks for your help Simon Elbaz ___ Zope3-users mailing list Zope3-users@zope.org https://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] label customisation
It's not the most elegant way but it does the job: def updateWidgets(self): super(StepAddForm, self).updateWidgets() AddAction = button.StaticButtonActionAttribute( u'Add Action', button=self.widgets['o_action_list'].buttons['add']) zope.component.provideAdapter(factory=AddAction, name='title') super(StepAddForm, self).updateWidgets() where o_action_list is the zope.schema.List field. I have to call super(StepAddForm, self).updateWidgets() because self.widgets is not avalaible before the call. Regards, Simon On Sun, Jul 14, 2013 at 3:12 AM, Simon Elbaz elbazsim...@gmail.com wrote: Hi, In the z3c.form.AddForm, zope.schema.List field is rendered with Add/Delete buttons. How to customize those labels ? My code does not have any effect: AddAction = button.StaticButtonActionAttribute( u'Add Action', button=multi.MultiWidget.buttons['add'], form=StepAddForm) Thanks for your help Simon Elbaz ___ Zope3-users mailing list Zope3-users@zope.org https://mail.zope.org/mailman/listinfo/zope3-users