Re: [Zope3-Users] Pluggable authentication, a newbie's question
David Johnson пишет: On Jan 29, 2007, at 5:30 PM, Alexei Ustyuzhaninov wrote: David Johnson пишет: What do you mean by Your authenticator is registered as a Plugin in a PAU in your current site? I registered the authenticator as a utility and assigned the utility name to the authenticatorPlugins attribute of the PAU. Is it enough? I'm not sure I follow you here. Normally when you create a custom authenticator you first go into Manage Site add a Pluggable Auth Utility (PAU). Then from within the PAU there are plugins. You can add your custom plugin here. Then you select a credentials plugin and your authenticator plugin. I'm not an expert by any means on PAU, but it seems this is the preferred approach. The authenticators I've written implemented the following: implements(AuthenticatorPlugin,IQueriableAuthenticator,IQuerySchemaSearch) Aha, seems that I see where is my problem. I didn't manage site through ZMI. Is it possible to do this manipulation programmatically? That I don't know. Probably. Why you would want to is another question. Well, I'm going to be able to deploy the package without using ZMI. That's why I'm seeking for a programmatic solution. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Problem with zc.table content internationalization
Hi, I currently have a little problem to translate contents displayed in a zc.table component. Here is an extract of my Python code : from onf import _ DRAFT = 0 # New document PROPOSED = 1 # Publication request CANCELED = 2 # Publication request canceled REFUSED= 3 # Publication request refused PUBLISHED = 4 # Publication approved StateLabels = { DRAFT : _(status-draft,Draft), PROPOSED : _(status-proposed,Publication request), CANCELED : _(status-canceled,Canceled publication request), REFUSED : _(status-refused,Refused publication request), PUBLISHED : _(status-published,Published) } class EventManagerSearchForm(BaseForm): ... columns = (... SortableColumn(_('status','Status'), lambda c,f: StateLabels.get(IWorkflowState(c).getState())), ...) @Lazy def formatter(self): return Formatter(self.context, self.request, self.values(),columns=self.columns) ZPT is as simple : html i18n:domain=onf ... table tal:replace=structure view/formatter / ... /html My problem is that the StateLabels are translated correctly in several templates, but not when used inside this table (I can only see the status-... translation key in generated output). So any help or advise would be very helpful... Thanks, 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
Re: [Zope3-Users] Pluggable authentication, a newbie's question
On Monday 29 January 2007 11:30, Alexei Ustyuzhaninov wrote: Aha, seems that I see where is my problem. I didn't manage site through ZMI. Is it possible to do this manipulation programmatically? Yes, we do it only this way. The site management API is very easy. See IComponents. Regards, Stephan -- Stephan Richter CBU Physics Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Pluggable authentication, a newbie's question
On Monday 29 January 2007 16:06, David Johnson wrote: Aha, seems that I see where is my problem. I didn't manage site through ZMI. Is it possible to do this manipulation programmatically? That I don't know. Probably. Why you would want to is another question. There is a lot of motivation for doing it this way. Alexei stated one in his response. During development you also want to throw databases away frequently. To set up everything in the ZODB by hand again is just totally lame. A lemma to this is that we always generate sample data for our applications (via z3c.sampledata or now z3c.configurator) so that we can test the application better. We use the sample data for manual and automated testing. It would be unpractical to do it by hand then. Regards, Stephan -- Stephan Richter CBU Physics Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Problem with zc.table content internationalization
On 1/30/07, Thierry Florac [EMAIL PROTECTED] wrote: My problem is that the StateLabels are translated correctly in several templates, but not when used inside this table (I can only see the status-... translation key in generated output). You'll need to use a SortableColumn subclass that performs the translation in the renderCell() method. -Fred -- Fred L. Drake, Jr.fdrake at gmail.com Every sin is the result of a collaboration. --Lucius Annaeus Seneca ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] problems using os.popen2 in a heavily used utility
Hi. i have a utility that generates thumbnails for objects that can be displayed as an image (faxes). the part that generates the thumbnail : def generate_thumbnail(self, data): Return a smaller view of the data stream # if data stream is a djvu file, convert it to ps before thumbnailing. magic = getUtility(IFileMagic) mimetype = magic.getMimeType(data) if mimetype == image/x.djvu: (stdin, stdout) = os.popen2(djvups - -) stdin.write(data) stdin.close() data = stdout.read() stdout.close() # Explenation of convert command line attributes : # -resize 150 : resize, while keeping aspect ratio, to a width of 150 pixels # -[1] : input file in stdin (-) to extract only frame 1: -[1]). #format detected automatically from data stream # png:- : output file on stdout (-) in png (png:) format (stdin, stdout) = os.popen2(convert -quiet -resize 150 - png:-) stdin.write(data) stdin.close() thumbnail = stdout.read() stdout.close() return thumbnail this utility is used by a view that displays a grid of a few thumbnails. when the view is loaded, several thumbnails are generated at once. (calls from the img tags to an /@@thumbnail view on the obect) some thumbnail make it through (very few), the rest fail with : 2007-01-30T21:54:06 ERROR SiteError http://moobox:8080/2007/inbox/05512/@@thumbnail Traceback (most recent call last): File /usr/lib/zope-3.3.0/lib/python/zope/publisher/publish.py, line 133, in publish result = publication.callObject(request, obj) File /usr/lib/zope-3.3.0/lib/python/zope/app/publication/zopepublication.py, line 161, in callObject return mapply(ob, request.getPositionalArguments(), request) File /usr/lib/zope-3.3.0/lib/python/zope/publisher/publish.py, line 108, in mapply return debug_call(obj, args) - __traceback_info__: bound method ThumbnailView.__call__ of zope.app.publisher.browser.viewmeta.ThumbnailView object at 0xb4f1c20c File /usr/lib/zope-3.3.0/lib/python/zope/publisher/publish.py, line 114, in debug_call return obj(*args) File /var/lib/zope/office/lib/python/base/visual/browser.py, line 59, in __call__ tf.write(self.data) File /var/lib/zope/office/lib/python/base/thumbnail/browser/thumbnail.py, line 41, in data return getAdapter(self.context, IVisual, name=thumbnail).data File /var/lib/zope/office/lib/python/base/thumbnail/thumbnail.py, line 21, in data thumbnail = tg.get_thumbnail(self.context) File /var/lib/zope/office/lib/python/base/thumbnail/utility.py, line 80, in get_thumbnail thumb.image = StringIO( File /var/lib/zope/office/lib/python/base/thumbnail/utility.py, line 67, in generate_thumbnail thumbnail = stdout.read() IOError: [Errno 4] Interrupted system call i read somewhere that os.popen2 is not friendly towards twisted framework, and that twisted.internet.reactor.spawnProcess or twisted.internet.process.Process should be used. i can't undersnad what format the parameter childfds should look like when calling those. could somebody show me the equivalent of (stdin, stdout) = os.popen2() ? ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users