[Zope3-Users] Re: Unable to Get Zope 3 running
Daniel Roberson wrote: > I am new at this but I have been unable to get Zope 3 to run correctly > from the internet or from another computer > on my internal network. > > I downloaded Python 2.4.0 and installed it. Note that at least Python 2.4.1 is required. I recommend the latest revision of Python 2.4, which IIRC is 2.4.3. > OK, got it running with no error on port 9090 as an HTTP server on > localhost. > > Ran the http://localhost:9090/manage command in the browser and I was > connected at least on the computer it is installed on. > > Now the problem. 1. Cannot access the ZOPE 3 server from the > internet or from a different machine on the internal network. Check your firewall settings on the Windows machine. It's probably not allowing any connections from the outside. > 2. Cannot run as a Windows Service. Sorry, am not a Windows user. Philipp ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Access request object from content_factory
Hi John, When I'm looking for the request object from somewhere like that I use from zope.security.management import getInteraction request = getInteraction().participations[0] Why this works is outlined (IIRC) in zope/app/securitypolicy/zopepolicy.txt. There may well be better ways to fish for the request than this... any offerings? Rupert ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Access request object from content_factory
Rupert Redington wrote: > from zope.security.management import getInteraction > > request = getInteraction().participations[0] > > Why this works is outlined (IIRC) in zope/app/securitypolicy/zopepolicy.txt. > > There may well be better ways to fish for the request than this... any > offerings? > In my understanding, if you need to look for the request inside a content object, you're doing something that should be done in another place, be it a view or an adapter. Of course, I've been wrong before :-] ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: Access request object from content_factory
Marco Mariani wrote: > Rupert Redington wrote: >> from zope.security.management import getInteraction >> >> request = getInteraction().participations[0] >> >> Why this works is outlined (IIRC) in zope/app/securitypolicy/zopepolicy.txt. >> >> There may well be better ways to fish for the request than this... any >> offerings? >> > In my understanding, if you need to look for the request inside a > content object, you're doing something that should be done in another > place, be it a view or an adapter. Indeed. > Of course, I've been wrong before :-] Not this time :). The hack displayed above (going thru the security interaction) should not be considered a standard procedure for getting at the request in places where you don't have it. Content objects are dull. They do nothing. Other stuff does things *to* them. Mats' solution is the better one. Philipp ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Splitting ZODB ?
Thierry FLORAC wrote: While using Zope2, I used to "split" my ZODB into several parts, using the "old" DBTab product configuration (which was finally included into Zope2). Can I setup this kind of configuration with Zope3 and, if so, how ? It's all ZODB, I would hope Zope 3's zope.conf would allow this in the same way that Zope 2 does... Of course, are there also any drawbacks ? More memory used by object caches and the like, but no, not really... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Access request object from content_factory
Philipp von Weitershausen wrote: > Marco Mariani wrote: >> Rupert Redington wrote: >>> from zope.security.management import getInteraction >>> >>> request = getInteraction().participations[0] >>> >>> Why this works is outlined (IIRC) in zope/app/securitypolicy/zopepolicy.txt. >>> >>> There may well be better ways to fish for the request than this... any >>> offerings? >>> >> In my understanding, if you need to look for the request inside a >> content object, you're doing something that should be done in another >> place, be it a view or an adapter. > I understand this... I think... > Indeed. > >> Of course, I've been wrong before :-] > > Not this time :). > > The hack displayed above (going thru the security interaction) should > not be considered a standard procedure for getting at the request in > places where you don't have it. Content objects are dull. They do > nothing. Other stuff does things *to* them. Mats' solution is the better > one. > That's me told :-) The place I found myself doing this was not in a content object, but in a local utility which needed to return some absolute urls: siteurl = zapi.absoluteURL(getSite(), getInteraction().participations[0]) I really don't like passing the request from the view to the utility's method - I often end up calling one utility from another and feel uncomfortable with forwarding the request through several calls - it just seems ugly. I realise that I shouldn't use zapi anymore... apart from that - what can I do to achieve the effect of lines like the one above without resorting to a hack? Furthermore I sometimes find myself using this in event subscribers - I can't see any way to get request data from an event... What am I missing this time? Cheers Rupert ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Access request object from content_factory
Well, I always like to do things the way the experts recommend :) Are there any suggestions for this use case?: I have a content class, which consists of 2 attributes: 1. a user comment 2. the name of the logged in user So far, I have been using the browser:addform directive to add instances, which generates all my views for me. (I love this and do not want to lose it). I have read about annotations and the DublinCore and I think I can go digging in __annotations__, if I make my class IAttributeAnnotable and get the logged in user name. The thing is, in this use case, the logged-in-user attribute is not metadata, it is a fundamental component of this particular content object. So, my question boils down to: what is the recommended way to get at the request object in a content factory when using browser:addform. The reason I think this matters is that there are so many adapters and utilities that need a request object, it seems unnecessary to deprive a content factory of the use of them, when the developer chooses to take advantage of browser:addform. Best wishes, John --- Philipp von Weitershausen <[EMAIL PROTECTED]> wrote: > Marco Mariani wrote: > > Rupert Redington wrote: > >> from zope.security.management import > getInteraction > >> > >> request = getInteraction().participations[0] > >> > >> Why this works is outlined (IIRC) in > zope/app/securitypolicy/zopepolicy.txt. > >> > >> There may well be better ways to fish for the > request than this... any > >> offerings? > >> > > In my understanding, if you need to look for the > request inside a > > content object, you're doing something that should > be done in another > > place, be it a view or an adapter. > > Indeed. > > > Of course, I've been wrong before :-] > > Not this time :). > > The hack displayed above (going thru the security > interaction) should > not be considered a standard procedure for getting > at the request in > places where you don't have it. Content objects are > dull. They do > nothing. Other stuff does things *to* them. Mats' > solution is the better > one. > > Philipp > > ___ > Zope3-users mailing list > Zope3-users@zope.org > http://mail.zope.org/mailman/listinfo/zope3-users > ___ Inbox full of spam? Get leading spam protection and 1GB storage with All New Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Formlib and fieldsets
Hi All, I can't find anything in Formlib to indicate that there's a well trodden path to handling fieldsets in formlib. I'm not really sure what the best way to do this is. Clearly the formlib form templates that I can see in Zope 3.2 don't contain any code for handling fieldsets - but that doesn't sound too hard to manage. Where though should fieldset definitions be handled? Rupert ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Access request object from content_factory
--- Rupert Redington <[EMAIL PROTECTED]> wrote: > I realise that I shouldn't use zapi anymore... apart Good gracious! No zapi? How did I miss that? Where do I get my utilities, parents, roots, adapters from now? John. (dazed and confused) ___ Inbox full of spam? Get leading spam protection and 1GB storage with All New Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Access request object from content_factory
John Smith wrote: > --- Rupert Redington <[EMAIL PROTECTED]> wrote: > >> I realise that I shouldn't use zapi anymore... apart > > > Good gracious! > > No zapi? > > How did I miss that? Where do I get my utilities, > parents, roots, adapters from now? > > John. > > (dazed and confused) > > I think the right answer to that is "wherever zapi got them from in the first place" reading zope/app/zapi/__init__.py is informative... Rupert ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Access request object from content_factory
Rupert Redington wrote: John Smith wrote: No zapi? How did I miss that? Where do I get my utilities, parents, roots, adapters from now? I think the right answer to that is "wherever zapi got them from in the first place" Well said. -- Benji York Senior Software Engineer Zope Corporation ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
RE: [Zope3-Users] store persistent objects
Hi all To fix the error I must change the __init__ of the BTreeContainer class to the follow: """ class persistent_test(BTreeContainer): implements(Ipersistent_test) def __init__(self): BTreeContainer.__init__(self) self['un_padre'] = Padre('Lety','Campanilla') """ Any idea about store object and list of objects? This way is the right way? Thanks in advanced Leticia Larrosa -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Leticia Larrosa Sent: Tuesday, June 20, 2006 11:03 AM To: zope3-users@zope.org Subject: [Zope3-Users] store persistent objects Hi all Resume: I want to store persistent data in the zope database. I must have an object that store others object inside it, including list of objects, etc. I want that when I create the root object automatically create object inside it. Example of python class: """ class Leave: name = u"" (...) class RootIndex: index_list = [] (...) class Root: name = u"" rootIndex = None leave_list = [] def __init__(self): self.rootIndex = RootIndex() """ I want store this data, for future access to it throw the user interface. I don't know which way is the best, even I don't have any way to do that yet ;) Any idea will be appreciated. Details: I create the following classes, interfaces and zcml directives and get the error when I create a persistent_test throw the ZMI: """ AttributeError: 'persistent_test' object has no attribute '_SampleContainer__data' """ My container overrides __init__ and set the __data value in my class ? (...) """ class IPadre(Interface): nombre_padre = zope.schema.TextLine( title=u"nombre padre", required=True, ) hijo = zope.schema.Object( schema=IHijo, ) class Padre(Persistent): implements(IPadre) nombre_padre = u"" hijo = Hijo(u"") def __init__(self, a_nombre_padre, a_nombre_hijo): self.nombre_padre = a_nombre_padre self.hijo = Hijo(a_nombre_hijo) class Ipersistent_test(IContainer): def __setitem__(name, object): """ Add an Ipersistent_test object. """ class persistent_test(BTreeContainer): implements(Ipersistent_test) def __init__(self): self['un_padre'] = Padre('Lety','Campanilla') """ In my configure.zcml """ """ Traceback: """ Traceback (innermost last): Module zope.publisher.publish, line 138, in publish result = publication.callObject(request, object) Module zope.app.publication.zopepublication, line 164, in callObject return mapply(ob, request.getPositionalArguments(), request) Module zope.publisher.publish, line 113, in mapply return debug_call(object, args) - __traceback_info__: > Module zope.publisher.publish, line 119, in debug_call return object(*args) 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 117, in pt_render strictinsert=0, sourceAnnotations=sourceAnnotations)() Module zope.tal.talinterpreter, line 239, in __call__ self.interpret(self.program) Module zope.tal.talinterpreter, line 314, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 869, in do_useMacro self.interpret(macro) Module zope.tal.talinterpreter, line 314, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 502, in do_optTag_tal self.do_optTag(stuff) Module zope.tal.talinterpreter, line 487, in do_optTag return self.no_tag(start, program) Module zope.tal.talinterpreter, line 482, in no_tag self.interpret(program) Module zope.tal.talinterpreter, line 314, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 839, in do_defineMacro self.interpret(macro) Module zope.tal.talinterpreter, line 314, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 941, in do_defineSlot self.interpret(block) Module zope.tal.talinterpreter, line 314, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 931, in do_defineSlot self.interpret(slot) Module zope.tal.talinterpreter, line 314, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 839, in do_defineMacro self.interpret(macro) Module zope.tal.talinterpreter, line 314, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 552, in do_setLocal_tal self.engine.setLocal(name, self.engine.evaluateValue(expr)) Module zope.tales.tales, line 698, in evaluate return expression(self) - C:\Python24\Lib\site
Re: [Zope3-Users] Re: Access request object from content_factory
Rupert Redington wrote: >> The hack displayed above (going thru the security interaction) should >> not be considered a standard procedure for getting at the request in >> places where you don't have it. Content objects are dull. They do >> nothing. Other stuff does things *to* them. Mats' solution is the better >> one. >> > > That's me told :-) > > The place I found myself doing this was not in a content object, but in > a local utility which needed to return some absolute urls: That already sounds like bad design. Why would the local utility worry about URLs at all? > siteurl = zapi.absoluteURL(getSite(), getInteraction().participations[0]) > > I really don't like passing the request from the view to the utility's > method - I often end up calling one utility from another and feel > uncomfortable with forwarding the request through several calls - it > just seems ugly. > > I realise that I shouldn't use zapi anymore... apart from that - what > can I do to achieve the effect of lines like the one above without > resorting to a hack? Don't have your utilities involve URLs... > Furthermore I sometimes find myself using this in event subscribers - I > can't see any way to get request data from an event... Why would you want to? If you really want to use events, throw an event that also holds on to the request. I still think that this wouldn't be necessary in most cases. Philipp ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] ldapadapter & friends
I'm using 3.3.0b1 trying to set up ldapadapter, ldappas & ldapauth from SVN, I see that ldapadapter uses deprecated ZCML and module locations While changing with , how am I supposed to replace this nameOnly parameter? Patch the source? Maybe it could be mentioned in http://kpug.zwiki.org/WhatIsNewInZope33#vocabulary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Access request object from content_factory
Philipp von Weitershausen wrote: > > That already sounds like bad design. Why would the local utility worry > about URLs at all? > It probably is :-) The utility is responsible for generating a PDF snapshot of a view - as seen by the invoking user at the point when the utility is invoked. To do this I open an HTMLDOC subprocess which needs a url to go to, and which needs to know which user to pretend to be so that it can authenticate... This is indeed all very ugly, but I needed it done and couldn't think of a better way at the time. I can't help feeling that to say that a utility should never ever concern itself with URLs is unnecessarily restrictive. > >> Furthermore I sometimes find myself using this in event subscribers - I >> can't see any way to get request data from an event... > > Why would you want to? If you really want to use events, throw an event > that also holds on to the request. I still think that this wouldn't be > necessary in most cases. I sometimes send out an email from an event handler and getInteraction().participations[0].principal.title is a convenient way to tell the recipient of the mail who it was that initiated the change... (from John's post I begin to understand that I might find the actors details stored in an annotation (if its an annotatable content object thats been altered)) Rupert (who clearly doesn't 'get' some things yet...) ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Access request object from content_factory
Rupert Redington wrote: > The utility is responsible for generating a PDF snapshot of a view - as > seen by the invoking user at the point when the utility is invoked. To > do this I open an HTMLDOC subprocess which needs a url to go to, and > which needs to know which user to pretend to be so that it can > authenticate... This is indeed all very ugly, but I needed it done and > couldn't think of a better way at the time. Right, but your choice of a utility component is debatable. If it needs the request, it should be a view (or a resource). Why not create a view for IBrowserView? Then you can get PDF snapshots of arbitrary views with URLs like http://host/someobj/@@index.html/@@pdf. @@pdf is a view for a view and would look like this: class PDFView(BrowserPage): # or BrowserView def __call__(self): html = self.context() # get the HTML of the view # you want as a PDF pdf = html2pdf(html) # 'html2pdf' is obviously # something you're doing now return pdf > I can't help feeling that to say that a utility should never ever > concern itself with URLs is unnecessarily restrictive. I don't think it is. Utilities perform a well-defined task on Python API level. URLs just aren't their concern. For example, it might still make sense to facilitate URLs in the above example: def __call__(self): html = self.context() # get the HTML of the view # you want as a PDF pdfgenerator = getUtility(IPDFGenerator) return pdfgenerator.fromHTML(html) As you can see, the utility still does what it's actual task is--generating PDF--but only that. That's the point of the Component Architecture. This utility, for example, would now be usable outside even a web app where there are no URLs and no requests... >>> Furthermore I sometimes find myself using this in event subscribers - I >>> can't see any way to get request data from an event... >> Why would you want to? If you really want to use events, throw an event >> that also holds on to the request. I still think that this wouldn't be >> necessary in most cases. > > I sometimes send out an email from an event handler and > getInteraction().participations[0].principal.title is a convenient way > to tell the recipient of the mail who it was that initiated the > change... (from John's post I begin to understand that I might find the > actors details stored in an annotation (if its an annotatable content > object thats been altered)) Yes, getting the data from DublinCore is a good idea. Philipp ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] store persistent objects
Leticia Larrosa wrote: Hi all To fix the error I must change the __init__ of the BTreeContainer class to the follow: """ class persistent_test(BTreeContainer): implements(Ipersistent_test) def __init__(self): BTreeContainer.__init__(self) self['un_padre'] = Padre('Lety','Campanilla') """ Any idea about store object and list of objects? This way is the right way? I'm not sure if I have understood your problem correctly, but here is what you probably could do: For Root: inherit from Persistent and call __init__ of parent class (btw: using super(CurrentClass, self) is the recommended way to do that) class Root(Persistent): def __init__(self): super(Root, self).__init__() self.rootIndex = RootIndex() For list: use PersistentList instead of list. For Leave and RootIndex: inherit from Persistent as well (and remember to call super(...).__init__ if you define own constructor) Regards, Alek Thanks in advanced Leticia Larrosa -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Leticia Larrosa Sent: Tuesday, June 20, 2006 11:03 AM To: zope3-users@zope.org Subject: [Zope3-Users] store persistent objects Hi all Resume: I want to store persistent data in the zope database. I must have an object that store others object inside it, including list of objects, etc. I want that when I create the root object automatically create object inside it. Example of python class: """ class Leave: name = u"" (...) class RootIndex: index_list = [] (...) class Root: name = u"" rootIndex = None leave_list = [] def __init__(self): self.rootIndex = RootIndex() """ ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: Splitting ZODB ?
Chris Withers wrote: > Thierry FLORAC wrote: >> While using Zope2, I used to "split" my ZODB into several parts, using >> the "old" DBTab product configuration (which was finally included into >> Zope2). >> Can I setup this kind of configuration with Zope3 and, if so, how ? > > It's all ZODB, I would hope Zope 3's zope.conf would allow this in the > same way that Zope 2 does... Actually, DBTab and Zope 2 used to monkey patch the ZODB to allow mount points. The ZODB has recently grown this feature itself and IIRC Zope 2 was fixed (by Theuni?) to use this functionality now. I don't think Zope 3's zope.conf exposes it yet, though. Would be a nice beginner sprint topic... Perhaps at the EP sprints? Philipp ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Splitting ZODB ?
Philipp von Weitershausen wrote: Chris Withers wrote: Thierry FLORAC wrote: While using Zope2, I used to "split" my ZODB into several parts, using the "old" DBTab product configuration (which was finally included into Zope2). Can I setup this kind of configuration with Zope3 and, if so, how ? It's all ZODB, I would hope Zope 3's zope.conf would allow this in the same way that Zope 2 does... Actually, DBTab and Zope 2 used to monkey patch the ZODB to allow mount points. The ZODB has recently grown this feature itself and IIRC Zope 2 was fixed (by Theuni?) to use this functionality now. I don't think Zope 3's zope.conf exposes it yet, though. Yes, it does. You can have multiple database sections and database sections can now have a name. The databases are registered as utilities and participate in a ZODB multidatabase. The first database defined is used as the root database. Zope 3 doesn't support mounting, but the same functionality is mostly trivially obtained using the ZODB multi-database APIs. Jim -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Splitting ZODB ?
Jim Fulton wrote: > Zope 3 doesn't support mounting, but the same functionality > is mostly trivially obtained using the ZODB multi-database APIs. Well, ok, then mounting support could a nice sprint topic :) ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Splitting ZODB ?
Philipp von Weitershausen wrote: Jim Fulton wrote: Zope 3 doesn't support mounting, but the same functionality is mostly trivially obtained using the ZODB multi-database APIs. Well, ok, then mounting support could a nice sprint topic :) Maybe, I'm not really sure it is necessary. Now you can just grab an object from one database and assign it as an attribute value of an object in another database. Much of the value of the Zope 3 mounting code was in getting around the limitation that cross-database object references weren't supported. BTW, it might be nice to start thinking about having some Foundation sprints. :) Jim -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users