Re: [Zope3-Users] proxied list object in a schema
On Sun, Dec 17, 2006 at 09:57:08PM +0100, FB wrote: On Sun, Dec 17, 2006 at 02:21:03PM +0100, Tim Terlegård wrote: Would someone like to explain how to use a list in a schema object without getting ForbiddenAttribute? This is my use case. class IChat(Interface): messages = Attribute('Chat messages') class Chat(Persistent): def __init__(self): self.messages = persistent.list.PersistentList() try that: class MyList(persistent.list.PersistentList): pass class class=.MyList ... /class You should find the necessary interfaces for your requires in zope.interface.common.mapping. This worked very well. I used ISequence from zope.interface.common.sequence. The good part is that I now understand why it should be done this way. Thanks. Tim ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Periodically refresh RSS feeds
Le mardi 19 décembre 2006 à 08:17 +0100, Christian Theune a écrit : Hi, Florian Lindner wrote: Hello, I have the following situation: An object represents an RSS feed. It should be updated like every 20 minutes. If there is something new a Jabber message should be send out. Currently I have it implemented with an scheduler loop that emits an refreshRSSFeed event evey 20 minutes. My problem is that a handler for an event must be a static function, but I want a handler function to be called as a member of every instantiated RSS feed object. Another idea I have: Implement an utility where the RSS feeds could register a function that is called every 20 minutes. Another way would be that this utility takes an URL and monitors the URL for changes and only notifies the RSS Feed object in case of a change. How would you do that? So there's two problems here: scheduling and notifying persistent objects about an event. I don't have a good idea about the scheduling right now, except the hint that using a 'zopectl run' script might be worthwhile. I'm not sure what a 'scheduler function is'. About notifying persistent objects: There is a method 'getAllUtilitiesRegisteredFor(interface)' which might help you. Have a look at zope/app/catalog/catalog.py beginning from line 150 (indexDocSubscriber) how the catalog handles events and dispatches them to multiple catalogs. I think this pretty much matches your use case if you make each RSS feed a (named) utility. Of course you could also have a utility that maintains references to all RSS feed objects and simply loops over them and calls a method for refreshing. Hi, I had a several problem to handle regular alerts which I solved in this way : - scheduling in done via the schedule package, available from Zope3 SVN ; I created an AlertManager utility which is a subclass of scheduler.CronTask (because my alerts are launched at fixed time, but you can use other classes) - objects which can raise alerts are registered with a specific interface IAlert - when the AlertManager is launched, it opens a new connection (via ZEO.ClientStorage), search for registered components (via zapi.getAllUtilitiesRegisteredFor(IAlert)) and call one of the interface's methods which may raise the alert. In my use case an email is sent, but it could be any kind of alert that Python can handle. I'm far to know if this is the best approach, but at least it works quite efficiently... 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] Periodically refresh RSS feeds
Am Dienstag, 19. Dezember 2006 08:17 schrieb Christian Theune: Hi, Florian Lindner wrote: Hello, I have the following situation: An object represents an RSS feed. It should be updated like every 20 minutes. If there is something new a Jabber message should be send out. Currently I have it implemented with an scheduler loop that emits an refreshRSSFeed event evey 20 minutes. My problem is that a handler for an event must be a static function, but I want a handler function to be called as a member of every instantiated RSS feed object. Another idea I have: Implement an utility where the RSS feeds could register a function that is called every 20 minutes. Another way would be that this utility takes an URL and monitors the URL for changes and only notifies the RSS Feed object in case of a change. How would you do that? So there's two problems here: scheduling and notifying persistent objects about an event. No, only the notifying problem. I don't have a good idea about the scheduling right now, except the hint that using a 'zopectl run' script might be worthwhile. I'm not sure what a 'scheduler function is'. I use the scheduler package from the Zope3 trunk and so far it works for me. About notifying persistent objects: There is a method 'getAllUtilitiesRegisteredFor(interface)' which might help you. Have a look at zope/app/catalog/catalog.py beginning from line 150 (indexDocSubscriber) how the catalog handles events and dispatches them to multiple catalogs. I think this pretty much matches your use case if you make each RSS feed a (named) utility. The RSS feed is a object that users could add and remove to arbitrary (sub-folders of there home-dir) folders. I would rather regard it as content object and I don't like adding utilities to content space (I have never really understood why content- and software-space have been mixed up). It would be possible, I think even technically superior to the next solution but somehome I don't like. Of course you could also have a utility that maintains references to all RSS feed objects and simply loops over them and calls a method for refreshing. That's something I had mentioned in my posting too. It has advantage that the feeds could decide if they want to be called or not, whereas by the utility-way they would always be called. Thanks for your input, Florian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Periodically refresh RSS feeds
Am Dienstag, 19. Dezember 2006 09:44 schrieb Thierry Florac: Le mardi 19 décembre 2006 à 08:17 +0100, Christian Theune a écrit : Hi, Florian Lindner wrote: Hello, I have the following situation: [...] Hi, I had a several problem to handle regular alerts which I solved in this way : - scheduling in done via the schedule package, available from Zope3 SVN ; I created an AlertManager utility which is a subclass of scheduler.CronTask (because my alerts are launched at fixed time, but you can use other classes) That's what I already use. - objects which can raise alerts are registered with a specific interface IAlert - when the AlertManager is launched, it opens a new connection (via ZEO.ClientStorage), search for registered components (via zapi.getAllUtilitiesRegisteredFor(IAlert)) and call one of the interface's methods which may raise the alert. In my use case an email is sent, but it could be any kind of alert that Python can handle. This is the same approach that Christian suggested. I have answered to his posting. Thanks, Florian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Periodically refresh RSS feeds
Hi, Florian Lindner wrote: That's something I had mentioned in my posting too. It has advantage that the feeds could decide if they want to be called or not, whereas by the utility-way they would always be called. Considering your hesitation towards the component architecture, here's some more input: Nowadays, registering a (persistent) object as a utility expresses basically the same functionality. If it wants to be called, you can register it as a utility for an interface (and maybe a name), if you don't want to, you don't (or you unregister it). What you automatically get is: - you don't have to write your own registry code (again), - the CA is optimized to do this kind of lookups The distinction between software and content space was pretty much removed now. Even content objects are software, or not? Christian -- gocept gmbh co. kg - forsterstraße 29 - 06112 halle/saale - germany www.gocept.com - [EMAIL PROTECTED] - phone +49 345 122 9889 7 - fax +49 345 122 9889 1 - zope and plone consulting and development signature.asc Description: OpenPGP digital signature ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Periodically refresh RSS feeds
Am Dienstag, 19. Dezember 2006 13:03 schrieb Christian Theune: Hi, Florian Lindner wrote: That's something I had mentioned in my posting too. It has advantage that the feeds could decide if they want to be called or not, whereas by the utility-way they would always be called. Considering your hesitation towards the component architecture, here's some more input: I have no hesitations towards the component architecture. If I had I would not use Zope3. ;-) Nowadays, registering a (persistent) object as a utility expresses basically the same functionality. If it wants to be called, you can register it as a utility for an interface (and maybe a name), if you don't want to, you don't (or you unregister it). What you automatically get is: - you don't have to write your own registry code (again), - the CA is optimized to do this kind of lookups Ok, these are two strong points. The distinction between software and content space was pretty much removed now. Even content objects are software, or not? Ehh, got me... Ok, I'm convinced, I'll probably do it this way. Regards, Florian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Grant problem
Hello, I get this error the i try to enter grant screen from ZMI: Does anyone know what is the problem? Traceback (most recent call last): Module zope.publisher.publish, line 133, in publish result = publication.callObject(request, obj) Module zope.app.publication.zopepublication, line 161, in callObject return mapply(ob, request.getPositionalArguments(), request) Module zope.publisher.publish, line 108, in mapply return debug_call(obj, args) __traceback_info__: security proxied zope.app.pagetemplate.simpleviewclass.SimpleViewClass from /usr/local/src/Zope3/src/zope/app/securitypolicy/browser/granting.pt instance at 0xb49d112c Module zope.publisher.publish, line 114, in debug_call return obj(*args) Module zope.app.pagetemplate.simpleviewclass, line 44, in __call__ return self.index(*args, **kw) Module zope.app.pagetemplate.viewpagetemplatefile, line 83, in __call__ return self.im_func(im_self, *args, **kw) Module zope.app.pagetemplate.viewpagetemplatefile, line 51, in __call__ sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0), Module zope.pagetemplate.pagetemplate, line 115, in pt_render strictinsert=0, sourceAnnotations=sourceAnnotations)() Module zope.tal.talinterpreter, line 271, in __call__ self.interpret(self.program) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 891, in do_useMacro self.interpret(macro) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 536, in do_optTag_tal self.do_optTag(stuff) Module zope.tal.talinterpreter, line 521, in do_optTag return self.no_tag(start, program) Module zope.tal.talinterpreter, line 516, in no_tag self.interpret(program) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 861, in do_defineMacro self.interpret(macro) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 957, in do_defineSlot self.interpret(block) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 949, in do_defineSlot self.interpret(slot) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 745, in do_insertStructure_tal structure = self.engine.evaluateStructure(expr) Module zope.tales.tales, line 696, in evaluate return expression(self) /usr/local/src/Zope3/src/zope/app/securitypolicy/browser/granting.pt Line 14, Column 4 Expression: PathExpr standard:u'view/principal_widget' - Names: {'args': (), 'context': zope.app.folder.folder.Folder object at 0xb4ba8e6c, 'default': object object at 0xb7da1560, 'loop': {}, 'nothing': None, 'options': {}, 'repeat': {}, 'request': zope.publisher.browser.BrowserRequest instance URL=http://212.59.24.114:9673/@@grant.html, 'template': zope.app.pagetemplate.viewpagetemplatefile.ViewPageTemplateFile object at 0xb61a968c, 'view': zope.app.pagetemplate.simpleviewclass.SimpleViewClass from /usr/local/src/Zope3/src/zope/app/securitypolicy/browser/granting.pt object at 0xb49d112c, 'views': zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object at 0xb49d1fcc} Module zope.tales.expressions, line 217, in __call__ return self._eval(econtext) Module zope.tales.expressions, line 211, in _eval return ob() Module zope.app.form.browser.source, line 198, in __call__ value = self._value() Module zope.app.form.browser.source, line 163, in _value if token is not None:UnboundLocalError: local variable 'token' referenced before assignment ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] How to get PAU working?
Hi, I'm trying to set up a user folder for my site, but i cant get the PAU to work. I add the Pluggable Authentication Utility object, register it, add PrincipalFolder and SessionCredentials plugins and register them. Add a user in the Principal folder. But then i try to login, i just get redirected to the same login form and nothing happens. What else do i need to do? Thanks in advance ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Grant problem
Hi, Jonas Jarutis wrote: Hello, I get this error the i try to enter grant screen from ZMI: Does anyone know what is the problem? Traceback (most recent call last): [...] Module zope.app.form.browser.source, line 163, in _value if token is not None:UnboundLocalError: local variable 'token' referenced before assignment Is this a standard instance? For one I consider it a bug in zope.app.form.browser.source in line 163, but that only affects the reporting. Your personal issue is something more complex. It looks a bit like some registrations aren't set up in your server. I'm guessing: either you're not loading some ZCML that is there by default, or your PAU is somewhat confused. Can you try with the same Zope software to create a new Zope instance and check whether you can enter the grant screen there? If you can, please try to find out the differences between this instance and the one that fails. Oh, and which Zope version is this? Christian -- gocept gmbh co. kg - forsterstraße 29 - 06112 halle/saale - germany www.gocept.com - [EMAIL PROTECTED] - phone +49 345 122 9889 7 - fax +49 345 122 9889 1 - zope and plone consulting and development signature.asc Description: OpenPGP digital signature ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] How to get PAU working?
Hi, On Wed, Dec 20, 2006 at 12:26:55AM +0200, Jonas Jarutis wrote: Hi, I'm trying to set up a user folder for my site, but i cant get the PAU to work. I add the Pluggable Authentication Utility object, register it, add PrincipalFolder and SessionCredentials plugins and register them. Add a user in the Principal folder. But then i try to login, i just get redirected to the same login form and nothing happens. What else do i need to do? This is what has to be done (in the right order!): 1. Add a PAU 2. Make sure, the PAU knows some users - e.g. this way: 1.Add a principalfolder 2.Add a principal into the folder 3.Configure the PAU to use the principalfolder 3. Make sure, the PAU is able to extract the credentials correctly (Session-Credentials are usefull for that) 4. Register the PAU Once the PAU is registered, the default IAuthentication utility which provides all the zcml-predefined principals becomes invisible (speak: useless). This means, you don't have a manager any more and you're unable to unregister the PAU again. For that reason, I wrote a Auth-Plugin which is like a principalfolder but all principals defined there are managers. However: I wrote a Mini-Howto on how to remove the registration of a PAU manually. Unfortunately it's in german: http://zope3.mpg.de/cgi-bin/twiki/view/Zope/ZodbMagic#RemoveRegistration - Please correct me if I'm wrong. Regards, Frank ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users