Re: [Zope3-Users] Need help with a Five / Viewlet Configuration Problem
It turned out that the problem was the viewlet manager. It was using the zope.viewlet.manager instead of the Five.viewlet.manager baseclasses. Once I changed the viewlet manager it worked fine. Kevin I am getting a ForbiddenAttribute error on 'render' when I try to display a viewlet in my Zope2 application. I am running zope 2.11.2 + Five. I am currently working on integrating grok + z3c.form into our stack. I have security a problem configuring the z3c.formjs.interfaces.IDynamicJavaScript viewlet. The viewlet configuration (in z3c.formjs) seems standard... browser:viewlet name=z3c.formjs.subscriptions manager=.interfaces.IDynamicJavaScript view=z3c.formjs.interfaces.IHaveJSSubscriptions class=z3c.formjs.jsevent.JSSubscriptionsViewlet permission=zope.Public layer=z3c.form.interfaces.IFormLayer / The viewlet is very standard. When I run the system, the viewlet is wrapped using the Products.Five.viewlet.metaconfigure functionality to provide a wrapped viewlet. However, when I run the application, I get this error... Module zope.viewlet.manager, line 107, in update Module zope.viewlet.manager, line 85, in filter Module zope.security.checker, line 134, in canAccess ForbiddenAttribute: ('render', Products.Five.viewlet.metaconfigure.JSSubscriptionsViewlet object at 0x84c0410) It appears to me that, at runtime, an incorrect 'checker' is being picked up. I believe that I should be seeing a call to Products/Five/security.py:checkPermission, but I believe I am picking up a different checker. I cannot seem to debug the checker, even though I set security-policy-implementation python in the zope.conf. Other (possibly) relevant information... (Pdb) adapter.__class__ class 'Products.Five.viewlet.metaconfigure.JSSubscriptionsViewlet' (Pdb) from Products.Five.security import getSecurityInfo (Pdb) getSecurityInfo(adapter.__class__) {'render__roles__': None, 'update__roles__': None, '__roles__': None, '__ac_permissions__': ()} (Pdb) from zope.security.management import thread_local (Pdb) thread_local.interaction Products.Five.security.FiveSecurityPolicy object at 0x84c0650 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Need help with an urgent problem
On Wed, Jan 07, 2009 at 01:28:24PM -, kevin gill wrote: I am having a problem on my live site. The problem is todo with a DataBase connector object which ends up in an incorrect state: This is the important part of the traceback. File /home/kevin/src/castingzone.tables/castingzone/tables/person/extraaccount_db.py, line 460, in IsValidUser result = self.execute('extraaccount.IsValidUser', self.IsValidUser.__doc__, **params) File /home/kevin/src/castingzone.utility/castingzone/utility/db/db.py, line 125, in execute return queryForResults(connection, query) File /home/kevin/src/castingzone.utility/castingzone/utility/db/db.py, line 28, in queryForResults cursor.execute(query) File /srv/zope/hosting/castingzone/instance/hacks/psycopgda-1.0-py2.4.egg/psycopgda/adapter.py, line 417, in execute return ZopeCursor.execute(self, operation, parameters) File /srv/zope/hosting/castingzone/eggs/zope.rdb-3.4.0-py2.4.egg/zope/rdb/__init__.py, line 261, in execute operation, parameters = self._prepareOperation(operation, parameters) File /srv/zope/hosting/castingzone/eggs/zope.rdb-3.4.0-py2.4.egg/zope/rdb/__init__.py, line 278, in _prepareOperation encoding = self.connection.getTypeInfo().getEncoding() File /srv/zope/hosting/castingzone/eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/Connection.py, line 798, in setstate raise ConnectionStateError(msg) ConnectionStateError: Shouldn't load state for 0x1d54 when the connection is closed If I'm not mistaken, this error typically occurs when you try to hold a reference to a Persistent object across transaction boundaries (e.g. by storing it in a global). Don't do that. Sometimes this happens in unexpected places (e.g. having a schema with an Object field that has a default value, and an edit form -- the default value is never explicitly copied, so you may end up with multiple references to it). I'm not saying this could be your problem; I'm just trying to remind you that some globals may be difficult to notice if you haven't been burned by them before. First thanks for the response. Once the server gets into this state, it seems to repeat often. The object in question is a database connection object. Are you talking about the persistent object with oid 0x1d54? The object class is known to me. It is a the postgres database adapter. I found this issue, which may cause the problem... I used to use a database adapter configured as a local utility. However, I changed to configuring it as a global utility because I need to access the database in some event subscribers and the event subscribers. I deleted the database adapter from my ++etc++site, but when I looked at the @@registrations.html view it was still there. I have removed the adapter using the @@registrations.html view and restarted. Unfortunately the problem takes some time to recur and I cannot replicate it in my test server, so I cannot be sure that this is a resolution. I have just retrieved it via an adapter lookup. It is not stored. connection= zope.component.getUtility(IZopeDatabaseAdapter, CONNECTION_NAME, self.context)() The database connection is provided by a global utility. The important code is as follows: def connection_directive(_context, name=CONNECTION_NAME, connection_string='', encoding='latin-1'): Process a db:Connection zcml directive # Don't delay to the end of the configuration process - gAdapter = PsycopgAdapter(connection_string) gAdapter.setEncoding(encoding) gAdapter.connect() provideUtility(gAdapter, IZopeDatabaseAdapter, name) This looks okay-ish to me (latin-1, yuck, is this the 20th century still?). I am in a parallel run. I can migrate to utf-8 only after I switch off the old system but I will - I need those euro symbols. Any help in narrowing down this problem would be greatly appreciated. It is making my live system unworkable. Start a debug console (zopectl debug or bin/debugzope), then take a look at oid 0x1d54: from ZODB.utils import p64 app.root()._p_jar.get(p64(0x1d54)) The interesting bit of information is the class name of that object. Then look through the sources trying to determine the lifetime of that object: where are references to it created? That is just what I needed. Although I had removed a registration for the deleted object, your snippet showed me that the object was still in my ZODB. I eventually tracked down the object as a 'subscriber' to utilities in a local registry I deleted the object using... lsm = root['mysite'].getSiteManager() from zope.rdb.interfaces import IZopeDatabaseAdapter # Display the adapter (direct and indirect) print lsm.utilities._subscribers[0][IZopeDatabaseAdapter] print lsm.utilities.subscriptions((), IZopeDatabaseAdapter) import transaction transaction.begin() # this may not be necessary # Delete the adapter lsm.utilities.unsubscribe
[Zope3-Users] Need help with an urgent problem
Hi, I am having a problem on my live site. The problem is todo with a DataBase connector object which ends up in an incorrect state: This is the important part of the traceback. File /home/kevin/src/castingzone.tables/castingzone/tables/person/extraaccount_db.py, line 460, in IsValidUser result = self.execute('extraaccount.IsValidUser', self.IsValidUser.__doc__, **params) File /home/kevin/src/castingzone.utility/castingzone/utility/db/db.py, line 125, in execute return queryForResults(connection, query) File /home/kevin/src/castingzone.utility/castingzone/utility/db/db.py, line 28, in queryForResults cursor.execute(query) File /srv/zope/hosting/castingzone/instance/hacks/psycopgda-1.0-py2.4.egg/psycopgda/adapter.py, line 417, in execute return ZopeCursor.execute(self, operation, parameters) File /srv/zope/hosting/castingzone/eggs/zope.rdb-3.4.0-py2.4.egg/zope/rdb/__init__.py, line 261, in execute operation, parameters = self._prepareOperation(operation, parameters) File /srv/zope/hosting/castingzone/eggs/zope.rdb-3.4.0-py2.4.egg/zope/rdb/__init__.py, line 278, in _prepareOperation encoding = self.connection.getTypeInfo().getEncoding() File /srv/zope/hosting/castingzone/eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/Connection.py, line 798, in setstate raise ConnectionStateError(msg) ConnectionStateError: Shouldn't load state for 0x1d54 when the connection is closed Once the server gets into this state, it seems to repeat often. The object in question is a database connection object. I have just retrieved it via an adapter lookup. It is not stored. connection= zope.component.getUtility(IZopeDatabaseAdapter, CONNECTION_NAME, self.context)() The database connection is provided by a global utility. The important code is as follows: def connection_directive(_context, name=CONNECTION_NAME, connection_string='', encoding='latin-1'): Process a db:Connection zcml directive # Don't delay to the end of the configuration process - gAdapter = PsycopgAdapter(connection_string) gAdapter.setEncoding(encoding) gAdapter.connect() provideUtility(gAdapter, IZopeDatabaseAdapter, name) Any help in narrowing down this problem would be greatly appreciated. It is making my live system unworkable. Thanks Kevin ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Zope3 and SQLAlchemy
I investigated these last month. At the high-level there are two options, ORM or Direct SQL. If you are going down the route of ORM, there are two well supported and active ORMs, SQLAlchemy and Storm. If you are going with alchemy, there are several options. I made a few notes as I was looking at them. For my purposes ore.alchemist and storm suited best. Here are my notes... dobbin: - Works like ZODB - Creates tables on the fly - No control over the schema - built on ore.alchemist - I failed to get this working. The documentation is not ZCML friendly. The connection mechanism is undocumented. It requires that UUID functionality is installed in postgreSQL. z3c.sqlalchemy - intergrates zope.sqlalchemy (see below) - provides a configuration mechanism - No integration to interfaces z3c.zalchemy (abandoned) - Integration of SQLAlchemy to Zope Transactions - Integration of interfaces - objects work like zope objects collective.lead - See Martin Aspellis book - Not zope objects (plone - archetypes) - see zope.sqlalchemy below zope.sqlalchemy - attempt to unify the integration of SQLAlchemy to the Zope transaction management machinery - Allows sqlalchemy to work in a Zope instance. - provides NO configuration mechanism z3c.saconfig - layer to provide 'scoped session support' on top of zope.sqlalchemy - SQLAlchemy session factory is a zope utility - Note: you cannot connect to the database during the xmlconfig pass. include package=z3c.saconfig file=meta.zcml / db:engine url=posgres://name:[EMAIL PROTECTED]/databasename echo=True / db:session twophase=True / ore.alchemist - of the alchemy ORM approaches, this worked best for me - simple container based mechanism for mapping a file to the ORM - 'bind' meta directive controls meta-data lookup after database connect Also, if you are going with SQL database only, have a look at lovey.zetup. This provides a ZODB'less mechanims for building your site. I hope this helps, Kevin Hi, I currently have to integrate an SQL database (PostgreSQL, with PostGIS extensions) into my Zope3 application. I'd like to use SQLAlchemy to handle this, and I've seen that several packages are available : z3c.zalchemy, z3c.sqlalchemy, zope.sqlalchemy... So my questions are simple : - what package is the best to plug into my Zope (3.3.1) application ? - do all these packages handle the same features ?? Thanks for any information, Thierry Florac -- Chef de projet intranet/internet Office National des Forêts - Département Informatique 2, Avenue de Saint-Mandé 75570 PARIS Cedex 12 Mél : [EMAIL PROTECTED] Tél. : +33 01.40.19.59.64 Fax. : +33 01.40.19.59.85 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users -- ** Email Scanned by Elive's Virus Scanning Service - http://www.elive.net ** ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] z3c.selectWidget terms without vocabulary
I want to create a select widget based on a field which does not have a vocabulary. The possible values are determined based on the context or the view. How do I configure the z3c SelectWidget to pick up the terms from a set of terms I provide, rather than looking to the field. I see from the code that it looks up a registered adapter, but I don't understand how to control this on a view instance basis. Thanks Kevin ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] z3c.selectWidget terms without vocabulary
OK, I have it working now. Here is what I did... 1. Subclass the schema type to create a specific class for my field, e.g. class LocalChoice(zope.schema.Choice): Marks this field uniquely 2. Make a new class based on z3c.form.terms.ChoiceTerms, and register it for the view and the schema field: zope.component.adapts( zope.interface.Interface, z3c.form.interface.IFormLayer, ViewClass, LocalChoice, z3c.form.interfaces.IWidget) 3. Put in the zcml adapter ... And it is picked up fine. Thanks Kevin I want to create a select widget based on a field which does not have a vocabulary. The possible values are determined based on the context or the view. How do I configure the z3c SelectWidget to pick up the terms from a set of terms I provide, rather than looking to the field. I see from the code that it looks up a registered adapter, but I don't understand how to control this on a view instance basis. Thanks Kevin ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users -- ** Email Scanned by Elive's Virus Scanning Service - http://www.elive.net ** ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Help: I cannot login after installing z3c.formjs
Thanks for the analysis. I did some digging and found that it was entirely my own fault. I have some code in the SessionCredentials object which stores the request annotations. I do this to handle extra information on the login form, e.g. login groups. Hmm, I've never gotten an error like that. It probably wouldn't be too difficult to patch jsclientevent.py by making sure caught events have security proxies removed before they are stored. But I wonder why any request related data is being stored in the database. My understanding is that session data gets stored in the database but is totally separate from the request. A cookie (stored in the request) is used to lookup the session data from the database. My gut instinct is that there is something wrong with the credentials plugin you are using because request annotations should never be persisted across multiple requests. I am using SessionCredentials myself without any problems. Can you find the code path that tries to store the request annotation? From a z3c.formjs perspective, if you want the caught events to not be security proxied, you could create another object event listener (like the one in z3c/formjs/jsclientevent.py) that goes through the caught events and removes security proxies. In the end this is a fragile solution because you can't guarantee the order in which events are handled, and unfortunately the way the zcml configuration is split up (not at all), it would be difficult to override this default event handler using an exclude directive. I'm currently making some improvements to z3c.formjs and will make sure to split up the zcml files more so doing such a customization is easier. There should be new releases of z3c.form and z3c.formjs in the next couple of weeks with these changes. I will be interested in seeing where you are going with formjs. I am really using it to get the AjaxRequestHandler at the moment. Thanks Kevin - Paul On Tue, Jul 15, 2008 at 7:51 AM, kevin gill [EMAIL PROTECTED] wrote: Hi, I am integrating z3c.formjs to a new site. After installing z3c.formjs I can no longer login. If I remove it, I can login again. It causes a problem with the SessionCredentials mechanism that I am using. The SessionCredentials annotations now contains event handlers of type z3c.formjs.jsclientevent.caughtEvents. These cannot be pickled. I tried both the PersisentSessionDataContainer and the RamSessionData Container. Does anyone have suggestions on how I might proceed with this? Thanks, Kevin This is the tail of the exception 2008-07-15T15:31:38 ERROR SiteError rm.commit(self) -- 2008-07-15T15:31:38 ERROR SiteError File /opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/Connection.py, line 541, in commit -- 2008-07-15T15:31:38 ERROR SiteError self._commit(transaction) -- 2008-07-15T15:31:38 ERROR SiteError File /opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/Connection.py, line 586, in _commit -- 2008-07-15T15:31:38 ERROR SiteError self._store_objects(ObjectWriter(obj), transaction) -- 2008-07-15T15:31:38 ERROR SiteError File /opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/Connection.py, line 613, in _store_objects -- 2008-07-15T15:31:38 ERROR SiteError p = writer.serialize(obj) # This calls __getstate__ of obj -- 2008-07-15T15:31:38 ERROR SiteError File /opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/serialize.py, line 408, in serialize -- 2008-07-15T15:31:38 ERROR SiteError return self._dump(meta, obj.__getstate__()) -- 2008-07-15T15:31:38 ERROR SiteError File /opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/serialize.py, line 420, in _dump -- 2008-07-15T15:31:38 ERROR SiteError self._p.dump(state) I investigated the offending object, and it is the SessionCredentials. After adding the ajax handlers, the SessionCredentials object is no longer pickleable. (pdb) state=obj.__getstate__() (Pdb) cPickle.dumps(state) *** UnpickleableError: Cannot pickle type 'zope.security._proxy._Proxy' objects (Pdb) state 'credentials', zope.app.authentication.session.SessionCredentials object at 0xafea8fcc),),),) (Pdb) credentials=state[0][0][0][1] (Pdb) credentials.request_annotations {'zope.app.publisher.browser.IUserPreferredLanguages': {'cached': ['en-gb', 'en']}, 'z3c.formjs.jsclientevent.caughtEvents': [zope.app.publication.interfaces.BeforeTraverseEvent object at 0xafea8e4c, zope.app.publication.interfaces.BeforeTraverseEvent object at 0xafea8dac, zope.app.publication.interfaces.BeforeTraverseEvent object at 0xafea8dcc, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb1b4c, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb1dac, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb1d2c
[Zope3-Users] Help: I cannot login after installing z3c.formjs
Hi, I am integrating z3c.formjs to a new site. After installing z3c.formjs I can no longer login. If I remove it, I can login again. It causes a problem with the SessionCredentials mechanism that I am using. The SessionCredentials annotations now contains event handlers of type z3c.formjs.jsclientevent.caughtEvents. These cannot be pickled. I tried both the PersisentSessionDataContainer and the RamSessionData Container. Does anyone have suggestions on how I might proceed with this? Thanks, Kevin This is the tail of the exception 2008-07-15T15:31:38 ERROR SiteError rm.commit(self) -- 2008-07-15T15:31:38 ERROR SiteError File /opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/Connection.py, line 541, in commit -- 2008-07-15T15:31:38 ERROR SiteError self._commit(transaction) -- 2008-07-15T15:31:38 ERROR SiteError File /opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/Connection.py, line 586, in _commit -- 2008-07-15T15:31:38 ERROR SiteError self._store_objects(ObjectWriter(obj), transaction) -- 2008-07-15T15:31:38 ERROR SiteError File /opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/Connection.py, line 613, in _store_objects -- 2008-07-15T15:31:38 ERROR SiteError p = writer.serialize(obj) # This calls __getstate__ of obj -- 2008-07-15T15:31:38 ERROR SiteError File /opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/serialize.py, line 408, in serialize -- 2008-07-15T15:31:38 ERROR SiteError return self._dump(meta, obj.__getstate__()) -- 2008-07-15T15:31:38 ERROR SiteError File /opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/serialize.py, line 420, in _dump -- 2008-07-15T15:31:38 ERROR SiteError self._p.dump(state) I investigated the offending object, and it is the SessionCredentials. After adding the ajax handlers, the SessionCredentials object is no longer pickleable. (pdb) state=obj.__getstate__() (Pdb) cPickle.dumps(state) *** UnpickleableError: Cannot pickle type 'zope.security._proxy._Proxy' objects (Pdb) state 'credentials', zope.app.authentication.session.SessionCredentials object at 0xafea8fcc),),),) (Pdb) credentials=state[0][0][0][1] (Pdb) credentials.request_annotations {'zope.app.publisher.browser.IUserPreferredLanguages': {'cached': ['en-gb', 'en']}, 'z3c.formjs.jsclientevent.caughtEvents': [zope.app.publication.interfaces.BeforeTraverseEvent object at 0xafea8e4c, zope.app.publication.interfaces.BeforeTraverseEvent object at 0xafea8dac, zope.app.publication.interfaces.BeforeTraverseEvent object at 0xafea8dcc, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb1b4c, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb1dac, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb1d2c, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb1c6c, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb1ccc, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb1c8c, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb1bcc, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb322c, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb344c, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb33cc, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb348c, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb354c, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb35ec, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb318c, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb362c, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb1a4c, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb1b6c, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb1f8c, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb190c, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb16ac, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb18cc, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb172c, zope.contentprovider.interfaces.BeforeUpdateEvent object at 0xafeb18ac]} (Pdb) credentials.request_annotations['z3c.formjs.jsclientevent.caughtEvents'][0] zope.app.publication.interfaces.BeforeTraverseEvent object at 0xafea8e4c (Pdb) cPickle.dumps(credentials.request_annotations['z3c.formjs.jsclientevent.caughtEvents'][0]) *** UnpickleableError: Cannot pickle type 'zope.security._proxy._Proxy' objects (Pdb) ev = credentials.request_annotations['z3c.formjs.jsclientevent.caughtEvents'][0] (Pdb) ev.object zope.app.folder.folder.Folder object at 0xb6034b6c (Pdb) cPickle.dumps(ev.object) *** UnpickleableError: Cannot pickle type 'zope.security._proxy._Proxy' objects (Pdb) cPickle.dumps(ev.request) *** TypeError: a class that defines __slots__ without defining __getstate__ cannot
Re: [Zope3-Users] Zope 3 security model
1. First, I believe you need Groups. In your Group folder, you set up logical groups. You assign permissions to the groups and then assign one or more groups to your membership. 2. For the owner, it depends on whether the owner is Zope information or not. In my environment, I have members who own listings. That information is stored on the relational database. I use a PrincipalRoleMap to map owners to objects. In my environment the 'owner' has less privileges than administrators so it is a bit different for the standard Zope concept of an owner. Regards, Kevin ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Grant Permission to a Group
How do I go about granting permission to a group of users to do copy/paste/move on a folder. The copy/paste/move adapters are configured as zope.ManageContent, and I don't want these users to have the rest of zope.ManageContent. Just be able to copy content types that they can create. I tried includeOverrides but that just gave a duplication error. I tried registering a new adapter, but the original adapter was always used. Thanks Kevin ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Best Practices - Zopeproject Deployment
So, I am now thinking that I will have to have instructions in my installation instructions that tell developers to edit the 'eggs-directory' line; correct? Also they will need to install buildout (or zopeproject) and create a project space before doing the checkout? You can avoid storing user specific information in your buildout.cfg by creating a ~/.buildout/default.cfg file in your home directory that contains user specific information: [buildout] eggs-directory = /Users/kteague/buildouts/shared/eggs If you leave the eggs-directory line out of a buildout.cfg, and it doesn't exist within a developer's ~/.buildout/default.cfg file, then buildout will simply create an eggs directory inside the project and put all of the eggs there. Quite tedious if you are working on a lot of buildouts since you will have multiple copies of the same eggs, but for production deployments you may wish for the entire buildout to be placed in a single isolated location - or if your developer's are only working on a single buildout-based project then they don't need to worry about setting/using the eggs-directory setting. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] How can I find all Local Registries (Sites)
How can I find all Local Registries (Sites)? I have a simple local utility that I need to register with a global utility when bootstrapping the application. I can find my global utility since it is in the global site manager. I registered my sites with the base local registry. I tried using the IDatabaseOpenedEvent and opening the database and getting the Application object and the root local registry. However, the local utilities I instantiate believe that they are in the global Registry. There is also a problem deleting a site which registered itself with a parent. Thanks Kevin ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Fwd: Re: [Zope3-Users] How do I set up layers for functional testing]
Thanks for the pointer, Stephen. I have changed the tests from using TestRequest to using etestbrowser. I also found that I was doing unit test things (placefulSetup) in my functional tests (which cleared down the configurations setup via ZCML). Thanks, Kevin On Tuesday 22 April 2008, kevin gill wrote: How do I functional test my z3c.forms views (in this scenario)? Due to a lack of time, I am not able to respond to your specific questions. But I can give you a hint. z3c.formdemo has functional tests. :-) Regards, Stephan -- Stephan Richter Web Software Design, Development and Training Google me. Zope Stephan Richter -- ** Email Scanned by Elive's Virus Scanning Service - http://www.elive.net ** ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] How do I set up layers for functional testing
I am trying to use the functional test tools on pages created with the z3c.forms library. zopeproject created a function testing layer for me in testing.py and matching ftesting.zcml. When I setup my z3c.forms layouts I registered my own layer and configured them on that specific layer (rather than the default layer). How do I functional test my z3c.forms views (in this scenario)? do I re-register the layout stuff on the functional layer? do I register the layout stuff directly and templates directly for the test. I found a snippet which does this for unittesting? or is there a way to get testing.py FunctionalLayer to inherit / include my application layer(s)? do I write simpler layout templates and register them for functional testing? or do I go read a good manual page on functional testing and layers that you can direct me to? :-) Thanks, Kevin ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] How do I automatically login a user
Thanks for that Jim, The code does what I want. I will have a good look at it and respond on zope-dev on Tuesday (I only work Tuesday, Wedensdays and Thurday). Thanks Kevin Let's move this discussion to zope-dev. On Apr 2, 2008, at 5:36 AM, kevin gill wrote: Please check in the code to the sandbox and I will have a look at it. The coding looks straight-forward, but choosing how to work it into the existing components. I will look at the code and come back with questions. I just checked 2 files, session.txt and session.py, into http://svn.zope.org/Sandbox/J1m/ These provide several features, most of which are of particular interest here: - An api to save session credentials independent of login, - saving sha-encoded passwords, - logout api - having an optional additional credential of a user domain, (probably not of general interest) Jim -- Jim Fulton Zope Corporation -- ** Email Scanned by Elive's Virus Scanning Service - http://www.elive.net ** ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] How do I automatically login a user
Please check in the code to the sandbox and I will have a look at it. The coding looks straight-forward, but choosing how to work it into the existing components. I will look at the code and come back with questions. Thanks Kevin On Apr 1, 2008, at 12:33 PM, kevin gill wrote: During my registration process I want to automatically login the user (in Zope3). I can see how to programatically logout a user using ILogout().logout(request), but I don't see an equivalent for logging in. I intend to use session cookies for tracking users. The most straightforward way is to interact with the session- credentials extractor directly to get it to save credentials for you. Unfortunately, the session-credentials extractor doesn't provide an API to do this. This would be a worthy addition. We have an internal session-credential extractor that does this. I don't have time to work this into the version in zope.app.authentication, but if someone wants to work on this, I'd be happy to check my code into the sandbox for someone to work from. Note that it also stores sha-encoded credentials. The current credentials extractor stores plain-text passwords in the session data which is extremely lame. Jim -- Jim Fulton Zope Corporation ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] How do I automatically login a user
During my registration process I want to automatically login the user (in Zope3). I can see how to programatically logout a user using ILogout().logout(request), but I don't see an equivalent for logging in. I intend to use session cookies for tracking users. Thanks Kevin ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: [Zope-dev] Zope 3.4.0 candidate 1 Released
Nabble provides a web forum bridge to the mailing lists. I use both the mailing list and the forums, depending on which forum/computer I'm using at the time. Here are the links: http://www.nabble.com/Zope-f6706.html http://www.nabble.com/Grok-f28342.html We've also embedded the Grok-Nabble forum inside the grok web site: http://grok.zope.org/community/grok-web-forums Grok is categorized under Web Development Framework and Python on Nabble, but all of the Zope lists are only categorized under Content Management Systems. Whoever has the keys to the Zope/Nabble registration should perhaps change the categorization to Web Development Framework and Python and Content Management Systems.___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Dynamic interfaces ?
The userschema package works in ways similar to what you are describing, and demonstrates how to instantiate new interfaces: http://agendaless.com/Members/tseaver/software/userschema/ ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] z3c.formjs in a viewlet
I am trying to put a z3c.formjs form into a viewlet. I run into a problem with the generation of the JSSubscriptions code in the resulting page. By default the formjs code puts the IHaveJSSubscriptions marker interface and the jsSubscriptions variable on the viewlet rather than the view. There is little difficulty in copying these to the view in the update() method. However, the set viewlets seem to be selected before my form viewlet begins to operate. Thus the viewlet selection code doesn't see the IHaveJSSubscriptions marker interfaces. (Am I making sense so far). My question is - how should I work around this problem? - I can mark the view in advance - I can render the subscriptions in the viewlet and thus have javascript in the body of the html result - I can give up and put the form in an IFrame Any suggestions? Thanks Kevin ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] z3c:layout - not working with z3c.form.EditForm
I am having a problem configuring a layout template. It works with z3c.form.DisplayForm but not with z3c.form.EditForm. formdemo works fine for me. It seems to use an identical approach. Thanks, Kevin --- Here is the details to recreate the problem: http://localhost:8080/++skin++MySkin/@@index.html does not use the template. http://localhost:8080/++skin++MySkin/@@index2.html uses the template. I added these packages (setup.py): 'z3c.pagelet', 'z3c.layer', 'z3c.form', 'z3c.formui', I configured these packages: !-- Add your own component registrations here -- include package=zope.viewlet file=meta.zcml/ include package=zope.contentprovider / include package=zope.viewlet / include package=z3c.form file=meta.zcml / include package=z3c.macro file=meta.zcml / include package=z3c.pagelet file=meta.zcml / include package=z3c.template file=meta.zcml / include package=z3c.form / include package=z3c.formui / include package=z3c.layer.pagelet/ include package=z3c.macro / include package=z3c.pagelet/ I created a new layer (layer.py): from z3c.form.interfaces import IFormLayer from z3c.layer.pagelet import IPageletBrowserLayer class IMyBrowserLayer(IFormLayer, IPageletBrowserLayer): pass And a new skin (skin.py): import z3c.formui.interfaces import layer class IMyBrowserSkin(z3c.formui.interfaces.IDivFormLayer, layer.IMyBrowserLayer): pass I registered the above: interface interface=.layer.IMyBrowserLayer type=zope.publisher.interfaces.browser.IBrowserSkinType / interface interface=.skin.IMyBrowserSkin type=zope.publisher.interfaces.browser.IBrowserSkinType name=MySkin / I create a layout (template.pt): h1TEMPLATE/h1 tal:block replace=structure provider:pagelet / I register it: z3c:layout for=* layer=.layer.IMyBrowserLayer template=template.pt / I create two new pages (browser.py): from z3c.form import form class IndexForm(form.EditForm): pass class IndexForm2(form.DisplayForm): pass I match these with templates (index.pt and index2.pt): index.pt index2.pt I register the new views: z3c:pagelet name=index.html for=* permission=zope.Public layer=.layer.IMyBrowserLayer class=.browser.IndexForm / z3c:template template=index.pt for=.browser.IndexForm layer=.layer.IMyBrowserLayer / z3c:pagelet name=index2.html for=* permission=zope.Public layer=.layer.IMyBrowserLayer class=.browser.IndexForm2 / z3c:template template=index2.pt for=.browser.IndexForm2 layer=.layer.IMyBrowserLayer / ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] z3c:layout - not working with z3c.form.EditForm
In answer to my own question, the EditForm must also inherit from the z3c.formuilayout.FormLayoutSupport class. This code now works: from z3c.form import form from z3c.formui import layout class IndexForm(layout.FormLayoutSupport, form.EditForm): pass Thanks, Kevin I am having a problem configuring a layout template. It works with z3c.form.DisplayForm but not with z3c.form.EditForm. formdemo works fine for me. It seems to use an identical approach. Thanks, Kevin --- Here is the details to recreate the problem: http://localhost:8080/++skin++MySkin/@@index.html does not use the template. http://localhost:8080/++skin++MySkin/@@index2.html uses the template. I added these packages (setup.py): 'z3c.pagelet', 'z3c.layer', 'z3c.form', 'z3c.formui', I configured these packages: !-- Add your own component registrations here -- include package=zope.viewlet file=meta.zcml/ include package=zope.contentprovider / include package=zope.viewlet / include package=z3c.form file=meta.zcml / include package=z3c.macro file=meta.zcml / include package=z3c.pagelet file=meta.zcml / include package=z3c.template file=meta.zcml / include package=z3c.form / include package=z3c.formui / include package=z3c.layer.pagelet/ include package=z3c.macro / include package=z3c.pagelet/ I created a new layer (layer.py): from z3c.form.interfaces import IFormLayer from z3c.layer.pagelet import IPageletBrowserLayer class IMyBrowserLayer(IFormLayer, IPageletBrowserLayer): pass And a new skin (skin.py): import z3c.formui.interfaces import layer class IMyBrowserSkin(z3c.formui.interfaces.IDivFormLayer, layer.IMyBrowserLayer): pass I registered the above: interface interface=.layer.IMyBrowserLayer type=zope.publisher.interfaces.browser.IBrowserSkinType / interface interface=.skin.IMyBrowserSkin type=zope.publisher.interfaces.browser.IBrowserSkinType name=MySkin / I create a layout (template.pt): h1TEMPLATE/h1 tal:block replace=structure provider:pagelet / I register it: z3c:layout for=* layer=.layer.IMyBrowserLayer template=template.pt / I create two new pages (browser.py): from z3c.form import form class IndexForm(form.EditForm): pass class IndexForm2(form.DisplayForm): pass I match these with templates (index.pt and index2.pt): index.pt index2.pt I register the new views: z3c:pagelet name=index.html for=* permission=zope.Public layer=.layer.IMyBrowserLayer class=.browser.IndexForm / z3c:template template=index.pt for=.browser.IndexForm layer=.layer.IMyBrowserLayer / z3c:pagelet name=index2.html for=* permission=zope.Public layer=.layer.IMyBrowserLayer class=.browser.IndexForm2 / z3c:template template=index2.pt for=.browser.IndexForm2 layer=.layer.IMyBrowserLayer / ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users -- ** Email Scanned by Elive's Virus Scanning Service - http://www.elive.net ** ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Viewlet Manager Configuration
Is it possible to pass parameters from a skin page template to a Viewlet Manager? The requirement is to use the same Viewlet Manager in different places on a page, and control the content based on configuration information. For example: Adverts are served on pages with unique slot information to track clicks. If we use a Viewlet Manager to display adverts, the page template could pass the slot id through to the Viewlet Manager, which ultimately could use this information to generate HTML with appropriate links. The alternative is to create multiple of Viewlet Managers with the contextual information coded in python. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Tutorial on Security Configuration with External DB Data
I have loaded a tutorial into the Zope3 wiki, Zope In Anger section about how to store security configuration on your relational database. It is essentially a second part of the How do I use SQLScript tutorial, as storing principals is the hard part of using an external database. If anyone has time to review the tutorial I would appreciate any feedback, http://wiki.zope.org/zope3/HowDoIConfigureSecurityInARelationalDatabase The SQLScipt Tutorial is at: http://wiki.zope.org/zope3/HowDoIUseSQLScript Thanks, Kevin ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] SQL and Zope3 Tutorial - Feedback needed
I found that there is a lack of documentation for using SQLDTML with Zope3. SQLAlchemy is newer and exciting and SQLDTML is mostly ignored. This is unfortunate as it works well and is well known to Zope2 developers. I have made an attempt to redress the balance by adding a tutorial on it to the ZopeInAnger section of the Wiki. http://wiki.zope.org/zope3/HowDoIUseSQLScript Unfortunately, the tutorial is quite long. The example code is attached to the tutorial. I would appreciate any feedback, particularly corrections, criticisms. I will (grudgingly) accept criticisms of my presentation style as well as the content. This is my first attempt to add to the documentation body for Zope. Thanks, Kevin ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] job opportunities
Hi all, I see job postings on the plone list from time to time so I hope you don't mind running these by eveyone on the list. The company I work for has hired this company to find a few good coders http://www.assembla.com/search/show_job/72 and http://www.assembla.com/search/show_job/74 For #72, you have to have hard core PHP and MySQL experience - I know it's not zope3 or even python, but I didn't think it would hurt to mention it. For #74, any RAD frame work will do - but I can say that python based frameworks like Zope3 - Zope3 and Grok, django, etc would work really well. If you're interested in responding but have any questions, feel free to respond to me off of the list. If I shouldn't post these here anymore - please feel free to flame me and I won't do it again :-) -Kevin p.s. Don't hate me for cross posting ways to make money doing cool things like working with zope3 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Prevent an event
Markkus, Thanks for your reply, I'm having scaling issues and want to be in control of the indexing process. I have a large number of documents already in the system. I believe the best case for me in the short run is to prevent the initial indexing on catalog creation and if understand it correctly, recursively touching all of my objects. Kevin Smith Markus Kemmerling wrote: Am 16.09.2007 um 21:00 schrieb [EMAIL PROTECTED]: Is there away to prevent the catalog from auto-indexing upon creation of the catalog? Why would you want to do this on the catalog level? You can exclude objects from being auto-(re-)indexed by implementing `zope.app.catalog`'s marker interfaces `INoAutoIndex` and `INoAutoReindex`, respectively. Regards, Markus Kemmerling ___ Markus Kemmerling Medical University Vienna Core Unit for Medical Education P.O. Box 10 A-1097 Vienna phone: +43-1-40 160-36 863 fax: +43-1-40 160-93 65 00 http://www.meduniwien.ac.at/bemaw/ ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Prevent an event
Is there away to prevent the catalog from auto-indexing upon creation of the catalog? Thanks, Kevin Smith ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] RE: Annotations when creating a Principal
Further to my last email, it appears that my error is using the FoundPrincipalFactory. I changed the code to use the getPrincipal method of the PAU and it works fine. pau = getUtility(IAuthentication) principal = pau.getPrincipal(principal_id) Thanks Kevin I am following the example in chapter 22 of Philipps book. I am setting up the PAU so that new users can register with the site. I am extending the example so that the information entered when creating the Principal is copied to the Annotations. Thus I can present the user with a one step sign-up. ... ** www.commuterhomes.ie - MyHome.ie are sponsoring the Commuter Homes Exhibition 2007 which takes place this Sunday 4th of March in The Lynch Green Isle Hotel, Naas Road, Dublin 22 from 1pm 6pm. FREE ADMISSION. ** The contents of this email and any attachments are confidential. They are intended for the named recipient(s) only. If you have received this email in error please notify the system manager or the sender immediately and do not disclose the contents to anyone or make copies. ** eSafe scanned this email for viruses, vandals and malicious content. ** ** ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Annotations when creating a Principal
Hi, I am following the example in chapter 22 of Philipps book. I am setting up the PAU so that new users can register with the site. I am extending the example so that the information entered when creating the Principal is copied to the Annotations. Thus I can present the user with a one step sign-up. I have changed the code on creating the new principal. I retrieve the principal, adapt it to the IMemberInfo class and set the email Annotation to the login name. Here is the code. principal_id = folder.signUp(login, password, title) pau = getUtility(IAuthentication) pi = PrincipalInfo(principal_id, login, title, u'') factory = FoundPrincipalFactory(pi) principal = factory(pau) memberinfo = IMemberInfo(principal) memberinfo.email = login This code runs but the metadata change is not saved to the database. My questions are ... Can I set metadata on an object in the interaction in which the object is being created? I am assuming that the principal returned by the FoundPrincipalFactory is the same as a normal principal when the use is logged in. Is this assumption valid? Is the meta data approach the best approach? Would it be easier to replace the InternalPrincipal with a content object which contains my new data? If I do that can I access that data via the standard principal machinery? Thanks in advance Kevin Gill ** www.commuterhomes.ie - MyHome.ie are sponsoring the Commuter Homes Exhibition 2007 which takes place this Sunday 4th of March in The Lynch Green Isle Hotel, Naas Road, Dublin 22 from 1pm 6pm. FREE ADMISSION. ** The contents of this email and any attachments are confidential. They are intended for the named recipient(s) only. If you have received this email in error please notify the system manager or the sender immediately and do not disclose the contents to anyone or make copies. ** eSafe scanned this email for viruses, vandals and malicious content. ** ** ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users