[Zope3-Users] Using z3c.jsonrpc with an existing skin
Hi i want to switch from jsonserver to z3c.jsonrpc, but i cant get it working. i have a skin defined: py: from zope.publisher.interfaces.browser import IDefaultBrowserLayer class IPreview(IDefaultBrowserLayer): zcml: interface interface=.IPreview type=zope.publisher.interfaces.browser.IBrowserSkinType name=myskin / my json methods: z3c:jsonrpc for=..interfaces.IGallery permission=zope.Public methods=getGallery getImages class=.json.GalleryJSONViews layer=bla.blest.skin.IPreview / the methods class derives from jsonrpc's Methodpublisher. my apache is setup to proxy all requests to the skin myskin i tried to derive my Skin from IJSONRPCRequest, but a json-rpc request always ends in a 404. the request content-type is correct 'application/json-rpc' please help thanks Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] searching for easy buildout.cfg to start with
hi i am searching for a simple buildout.cfg, which installs the latest zope 3.4 rc1 with a filestorage and one instance. i would like to switch an existing z3 applikation to buildout, for a comfortable deployment. this app i would check out via infrae.subversion. build i cant find any working example for a simple instance setup. maybe someone can help. thanks Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: catalog of objects' states (hurry.workflow)
Alek Kowalczyk schrieb: Hello again, I have a rather big tree of MyObjects. MyObjects are adaptable to hurry.workflow's IWorklowState. Now I'd like to create a catalog to index all MyObjects by their current states. How to do that? An option might be(?) to add to MyObject property like that: @property def currentState(self): return IWorkflowState(self).getState() and index this property. But I'm not sure whether it is elegant solution, as it requires the object to know that it has workflow and (too) strong link between object and adapter. I'll appreciate any suggestions how to index workflow states cleanly and not in too complictated way... Regards! i use the @property solution, because i got into troubles with annotations and the catalog. see the unanswered post http://mail.zope.org/pipermail/zope3-users/2007-March/005925.html cheers Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Using RAMCache
hi i would like to cache the results of method in a view, and thougt, that RAMCache could be of use here. After spending a lot of time searching for some documentation or examples, i came to this: from zope.app.cache.ram import RAMCache cache = RAMCache() query = cache.query('test',key={'x':1}) if query == None: result = expensive_stuff_method() cache.set(result, 'test', key={'x':1}) return result else: return query but that won´t work, the cache looses it´s entry, if i call the browser-view again. any hints? thanks, Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] problems deleting objects in containers
hi i want to delete objects in my container, for that i do for xx in container.keys(): logging.info(xx) del container[xx] but only every second obj is deleted, the loop touches objects in this order: 1,3,5,7,. if i remove the del statement from the upper example, the loop works as expected: 1,2,3,4,5,6... i also looked at zope.app.container.container.browser.contents.py to see how deletion is handled there. nothing special found. i´m a bit confused, please help :) tnx Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] problems deleting objects in containers
Dominique Lederer wrote: hi i want to delete objects in my container, for that i do for xx in container.keys(): logging.info(xx) del container[xx] but only every second obj is deleted, the loop touches objects in this order: 1,3,5,7,. if i remove the del statement from the upper example, the loop works as expected: 1,2,3,4,5,6... oh, ok, i should not mess arround with the container keys while deleting from the container ;) i fixed it with: for xx in [key for key in container.keys()]: del container[xx] ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Blog naming proposals
Florian Lindner wrote: Hello, some people might have noticed I am developing a Blog package for Zope3. Since it slowly becomes functional (an older version is working at http://xgm.de) I want to release it (under an free and open source licence). One thing still missing is a good name. A name that quickly comes to my mind is zBlog but which is not very fancy. What ideas have you for Zope3 blog package, what would you choose? Regards, Florian blogg3rz with 3 for zope 3 and z for zope? but maybe to much of Leetspeak. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] formlib handling of adapters
hi i just tried to adapt an object with two similar interfaces: class IBaseAdapter(Interface): content = Text(title=uContent, required=False) class IHomeAdapter(IBaseAdapter): class ILinksAdapter(IBaseAdapter): after that, i created two formlib editform views and registered them on my adapted object. The content property is saved on different annotation keys on the adapted object. The form renders correctly, but the content property is only handled via the ILinksAdapter by formlib. so content is saved always on the same annotation key. if i change my interfaces to class IHomeAdapter(Interface): content = Text(title=uContent, required=False) class ILinksAdapter(Interface): content = Text(title=uContent, required=False) formlib works and uses the two different adapters implementations. looks like a bug, can somebody confirm or comment this? cheers Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] getting random results out of a catalogs field index
hi i would like to retrieve a number of *random* entries out of a catalogs field index. i tried it with first getting the catalogindex-length an then accessing a randomized list-index, but this is very slow, because of the large number of entries in the index. do you know any better solution? thanks a lot Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] getting random results out of a catalogs field index
Christian Theune wrote: Am Samstag, den 05.05.2007, 17:42 +0200 schrieb Dominique Lederer: hi i would like to retrieve a number of *random* entries out of a catalogs field index. i tried it with first getting the catalogindex-length an then accessing a randomized list-index, but this is very slow, because of the large number of entries in the index. do you know any better solution? I'm kind of guessing here. You say you are: - querying the catalog - accessing a random index from the result set - noticing that this is slow Does this only happen if the index is very large, e.g. you're retrieving an element from the end of the result set? I don't know exactly how the result sets are organized, but this behaviour would imply that loading a later element triggers something like loading the earlier elements too. I can't really imagine that. I think the general problem that this is slow lies in the fact that randomly selecting elements means a) you need access to the full list of things b) applying a sort Sorting has a complexity of at least O(n log n) which becomes slow enough for large sets that it's noticable. BTW: How large is large? Christian hi, thanks for the reply, i just managed to improve the performance of my query significantly: what i wanted to do was: - retrieve the len() of the catalog index - retrieve a list() of the Resultset - accessing n random results and their objects to retrieve a random object i did: query = catalog.apply({'myIndex':(None,None)}) length = len(query) index_intids = list(query) intid = all[random.randint(0,len_all-1)] object = getObject(intid) which was with 1 items in the index slow (i had to wait 2-3 seconds for a view to render) after looking into the field index implementation i changed the above lines to: length = len(catalog['myIndex']._rev_index) index_intids = list(catalog['myIndex']._rev_index.keys()) which now works like a charm. i am not an expert with BTrees so i cant really say what the problem is/was. Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] handling a mass of images/files
hi i´m just thinking about, how to handle a lot of images within my zope3 application. what would you recommend to do: a) save all images into the zodb b) use z3c.extfile i looked a bit into z3c.extfile´s documentation, an found, that i returns file-data from the filesystem, which are stored there in a hashdir. i wonder if this would be quicker than accessing the images from the zodb? a third approach, similar to b) would be to serve the hashdir with apache, and let the z3c.extfile just return the path to the image. i just did not find out how to achieve that with the package. maybe someone could give me a hint on this? i would be glad, if you could give me your option on this. thanks a lot regards, Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] problems with catalog: indexing field from an objects adapter
hi, I want to index a field from an object, which works perfectly via Catalog and Field Index. But if my callable field returns a value, which is returned from an adapter of the object, things get complicated for me: i create my object an add it to a container (not via zmi). i do the notify(ObjectCreatedEvent(container[myobjectname]) thing, to let the intid and catalog do their indexing stuff. i look at the Catalog statistics in the zmi, where is see, that one item is indexed. but when i delete the object (i used notifiy(ObjectRemovedEvent(container[myobjectname])), there is still something residing in the index, which causes a KeyError in the intid utility, when it trys to getObject. It seems, that the index is indexing the object and the adapter via the same unique intid, and then deletes only the objects index, and not the adapter? since my adapter is only accessing annotations on the object, i could feed the index directly via the annotation value, but that goes against the use of adapters and the idea, not to change the object implementation. Do you have any idea, what i have to do? Did i forget an event? or something else? thanks cheers Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] view vs page confused
Marius Gedminas schrieb: On Wed, Jan 24, 2007 at 08:31:52PM +0100, Dominique Lederer wrote: can someone explain me please when to use browser:view and when browser:page? As far as I understand, the intended use of browser:page is to define views that are accessible to browsers by using URLs. The intended use of browser:view is to define helper views that are accessible to page templates in TALES expressions like tal:attributes=href context/@@absolute_url. I might be wrong. and when would i inherit a View Class from zope.publisher.BrowserView and when from zope.publisher.BrowserPage, and why do i need them when i could just inherit from object without any errors? A browser page must implement IBrowserPublisher if you want it to be accessible from the outside. BrowserPage does that. The browser:page also does that, but in a different way. The directive does deep magic -- it constructs a new class on the fly that implements IBrowserPublisher and inherits from the view class you've specified. It can also provide a 'index' attribute and a default implementation of __call__. BrowserView only gives you a useful __init__. If you inherit directly from object, you'll have to define __init__ by yourself. Looking at the code I see that BrowserView also gives you a __parent__ property that is used by the standard Zope 3 security policy. I do not think it is all that important, as usually views in Zope3-land are not security proxied. Magic is going out of fashion in Zope3-land. In my personal opinion the best practice for Zope 3 views is to follow this pattern: class MyView(BrowserPage): adapts(ISomeContext, IBrowserRequest) template = ViewPageTemplateFile('...') def __call__(self): # do form processing, if any return self.template() and then register it with browser:page. so if i create a class which inherits from BrowserView, and then register it via zcml as browser:page, it becomes adaptes to IBrowserRequest an turns to a BrowserPage (via the on-the-fly created class)? so inheriting from BrowserPage instead from BrowserView would make no sense with my example? cheers Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] i18n question
i have a viewlet where this method resides: def title(self): from zope.i18nmessageid import MessageFactory _ = MessageFactory('my_domain') return _(self.__name__) the pagetemplates for the viewlet renders the title like p tal:content=view/title / the templates renders without errors, but if i use i18nextract to get the message catalog, my title(s) never get cataloged. what am i missing? thanks Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] i18n question
Dominique Lederer schrieb: i have a viewlet where this method resides: def title(self): from zope.i18nmessageid import MessageFactory _ = MessageFactory('my_domain') return _(self.__name__) the pagetemplates for the viewlet renders the title like p tal:content=view/title / the templates renders without errors, but if i use i18nextract to get the message catalog, my title(s) never get cataloged. what am i missing? i just tried a bit more, so i guess the problem is, that self.__name__ is in my case dynamically filled. is the only way there to add these entries by hand to the .mo file, or are there other approaches to this? thanks, Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Error when calling addform
Florian Lindner schrieb: Am Dienstag, 13. Februar 2007 12:04 schrieb Stephan Richter: On Monday 12 February 2007 15:56, David Johnson wrote: Many people have offered approaches. I find the simplest and cleanest approach for declaring interfaces is as follows: The cleanest way, in my opinion, is just not to use the addform directive altogether. zope.formlib is the wildly accepted successor. Ok, I've done it now if the formlib. Do I really have to create and set all fields manually? class BlogCommentAddForm(form.AddForm): form_fields = form.Fields(IBlogComment) def create(self, data): comment = BlogComment() comment.name = data[name] comment.email = data[email] comment.content = data[content] return comment If I just omit create is complains that the function must be implemented. Can this be done easier? you can do this with def create(self, data): comment = BlogComment() form.applyChanges(comment, self.form_fields, data) return comment hth Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Standard Macros
Hassan Alirezaei schrieb: Hi Marius thanks for the response. you are right that was a typo, views/standard_macros is totaly wrong. however, the problem still remains the same: even html metal:use-macro=context/@@standard_macros/page /html or html metal:use-macro=template/@@standard_macros/page /html won't work. I get the same old error as my other post. Any Ideas are appriciated. and more importantly, do other people get the same error as I get??? I would really appriciate if someone tried the above code in a ZPTPage through ZMI and tell me the results... Thanks alot. Hass same here, also with authenticated users from a PAU ZCML user are working Module zope.tales.expressions, line 217, in __call__ return self._eval(econtext) Module zope.tales.expressions, line 194, in _eval ob = self._subexprs[-1](econtext) Module zope.tales.expressions, line 124, in _eval ob = self._traverser(ob, element, econtext) Module zope.app.pagetemplate.engine, line 68, in __call__ request=request) Module zope.traversing.adapters, line 164, in traversePathElement return traversable.traverse(nm, further_path) - __traceback_info__: (Principal(u'test1'), 'title') Module zope.traversing.adapters, line 52, in traverse raise TraversalError(subject, name) - __traceback_info__: (Principal(u'test1'), 'title', []) TraversalError: (Principal(u'test1'), 'title') regards Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Permission problem on adapter
FB schrieb: Hi, On Sun, Feb 11, 2007 at 01:16:51AM +0100, Dominique Lederer wrote: hi i created a trusted adapter on a content object. then i created a formlib edit page for the ZMI, to be able to edit the new attributes on the adapted content object. the adapters interface is correctly rendered to the form. if i try to edit, an unauthorized error is shown, which i also get, when i register the user as Site Manager via Grant in the ZMI. The global admin *can* edit the adapters attributes (the one which is set globally via ZCML). i registered the adapter like this: adapter factory=.MyClassAnnotations trusted=true / Try to add the attribute 'locate=true' to the adapter-statement. Thank you, that worked! According to Philipps Book, locate should default to 'true', maybe a typo? Regards Dom ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] css/page template ?
tyson schrieb: I am having trouble getting my style sheet to load in my page template. I added my .css file within the local package directory. How can I point to this file on the filesystem. I tried using a layer with a resource in my configure file, but that didn't work. Any help would be much appreciated, thanks. just register your .css file as ressource via ZCML: ... browser:resource name=yourfile.css file=yourfileonfilesystemin samefolder.css / ... you can access it then via {$site}/@@/yourfile.css {$site} is the URL of the nearest site. Dom ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Permission problem on adapter
hi i created a trusted adapter on a content object. then i created a formlib edit page for the ZMI, to be able to edit the new attributes on the adapted content object. the adapters interface is correctly rendered to the form. if i try to edit, an unauthorized error is shown, which i also get, when i register the user as Site Manager via Grant in the ZMI. The global admin *can* edit the adapters attributes (the one which is set globally via ZCML). i registered the adapter like this: adapter factory=.MyClassAnnotations trusted=true / class class=.MyClassAnnotations require permission=zope.View interface=.interfaces.IMyClassAnnotations / require permission=zope.ManageContent set_schema=.interfaces.IMyClassAnnotations / /class i can surpress the error, if i change the set_schema permission to zope.View. But i think that is just a bad workarround. what am i missing? thank you for your help. traceback is: Module zope.formlib.form, line 757, in __call__ self.update() Module zope.formlib.form, line 738, in update result = action.success(data) Module zope.formlib.form, line 582, in success return self.success_handler(self.form, self, data) Module zope.formlib.form, line 795, in handle_edit_action if applyChanges(self.context, self.form_fields, data, self.adapters): Module zope.formlib.form, line 509, in applyChanges field.set(adapter, newvalue) Module zope.schema._bootstrapfields, line 183, in set setattr(object, self.__name__, value) Unauthorized: (pathto.MyClassAnnotations object at 0xa6e9ad2c, 'headline', 'zope.ManageContent') ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] select field with Choice widget and formlib
hi i render a form with formlib which contains a selectbox: form_fields = Fields( Choice(__name__='selectbox', required=False, values=[value1,value2,value3]), ) the rendered output always includes a extra option which contains this message-id vocabulary-missing-single-value-for-edit like: option selected=selected value=Wert aus Vokabular mit einem Wert fehlt/option option value=value1value3/option option value=value2value3/option option value=value3value3/option how do i get rid of this? thanks Dom ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] interview for my diploma thesis about Zope 3 in education
David Johnson schrieb: * Do you think Zope (3) can be used at school or university level to support topics in computer science education? What topics would you recommend? Why? I definitely think Zope 3 can be used to support education. We plan on developing a number of applications in this area. It seems at present that universities are focusing on J2EE and .NET, like most companies. We are also noticing an increasing ability of universities to do their own development. Traditionally many of the software applications that universities use have been purchased. We see an increasing desire to build and customize applications in house. We also find however that in universities the funding and resources required to manage a J2EE or a .NET project are not necessarily there. We believe Zope could fill this role because it is faster to develop in, and python is fairly easy to learn. We find that universities tend to have developers who are a bit less experienced, and this sometimes includes administrators who actually want to do their own development. J2EE and .NET is not easy to pick up for the novice. In this area Zope 3 is particularly challenging in comparison to Zope 2, however there are entry points in Zope 3 with a minimal amount of TTW development. In this sense I personally feel strongly that Zope 3 needs to have a greater emphasis on TTW development so that it can satisfy the needs of the intermediate developers. However I feel that Zope 3 is such a clean and well developed platform that more of these tools will show up. i am definitly with you on your thoughts. i also think that zope, especially zope 3 is a great tool supporting an educational infrastructure. schooltool shows us how to do that. but my question was more about how could someone use Zope 3 *in* his curriculum. my thoughts are like being able to teach topics like software development process, testing strategies (in my opinion software testing is bad supported in education), documenting software (doctests), and all this stuff should have an easy approach (installing, maintaining, developing), both for educators/lectors and students. i think Zope 3 could do a great job there, and i would like to know the community´s optinion about that. * How do you see Component Based Software Engineering (CBSE) related to Zope 3? What are the differences? Is Zope 3 an alternative for other component based frameworks in the industry and why? I'm not sure I understand the question on this one. Zope can be used to provide components in an XML-RPC model, or just about any other; this is the nature of the content view model of Zope. This question has a litle bit historical background. At my university they taught us Component Based Software Engineering (CBSE), and how this will change the way, software will be developed. Software development will(may) change to an industry where focus is on components, reuse and testing (at the moment thousends of developers code the same stuff) In the same course they talked about CORBA, COM+ and EJB. My question is: Can they also talk about Zope 3 there? Hope that this question is more clear now. One point of view. Hope it helps. yes, thanks for your reply!! hope to get more :) cheers Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] view vs page confused
hi! can someone explain me please when to use browser:view and when browser:page? and when would i inherit a View Class from zope.publisher.BrowserView and when from zope.publisher.BrowserPage, and why do i need them when i could just inherit from object without any errors? and what means the @@ or ++view++ if i can access a view(page?) without that? i am really confused :) please help. thanks Tom -- Feel free - 5 GB Mailbox, 50 FreeSMS/Monat ... Jetzt GMX ProMail testen: http://www.gmx.net/de/go/promail ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] interview for my diploma thesis about Zope 3 in education
Hello list! currently i am writing my diploma thesis at the University of Applied Science in Austria, Vienna. The topic is about the usage of Python and Zope (3) in education. There are a lot of papers concerning Python and education, but i found not much about Zope there. So this seems an interesting topic to discuss. For my diploma thesis, i would like to ask you to anwer or discuss a few questions, to see, what you think about this. (of course i will cite all the stuff) Here they are: * Do you think Zope (3) can be used at school or university level to support topics in computer science education? What topics would you recommend? Why? * How would you convince someone who is in charge to use Zope 3 in his curriculum? * How do you see Component Based Software Engineering (CBSE) related to Zope 3? What are the differences? Is Zope 3 an alternative for other component based frameworks in the industry and why? * How do you see the future of Zope? Where do you (want to) see it in 2 years? thank you very much cheers Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zope.testbrowser and vhost
Gary Poster schrieb: On Jan 2, 2007, at 2:29 PM, Benji York wrote: Dominique Lederer wrote: i see there is a VirtualHostingBrowser class in zope.testbrowser.testing, but i dont have a clue on how to use this. Use VirtualHostTestBrowserSuite instead of unittest.TestSuite and the tests you add to the suite will be run twice: once normally and again in a virtual hosting environment. Right now it doesn't have the flexibility to do what it sounds like you want (i.e., insert a skin). Some small adjustments could probably make it possible. As long as the default behavior doesn't change I think it would be fine. mea culpa for the lack of docs and tests. They are welcome. Gary Thanks for your responses, what i would like to do is ftesting an application from the users side (behind a skin), which already has some data stored in the ZODB, so i first tried to browser.open('http://localhost/myapp/') but i got a 404 same result with accessing a skin then i tried browser.open('http://localhost/') browser.contents an tried to find the myapp entry in the html-code, but myapp is gone. Is this because of a clean environment generated with zope.testbrowser.testing ? ok, now i could test the UI behavior of myapp with zope.testbrowser.browser, but how would i revert changes i made with the test? or is there any other approach to this? thanks Dom ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] zope.testbrowser and vhost
hi! i would like to use zope.testbrowser to test my vhosted site http://localhost:8080/++skin++myskin/mysite/++vh++http:my.example.com:80/++/ i see there is a VirtualHostingBrowser class in zope.testbrowser.testing, but i dont have a clue on how to use this. any help would be nice. thanks Dom ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] ForbiddenAttribute when adding to a folder
Darryl Cousins schrieb: Hi Tim, On Sat, 2006-10-21 at 12:18 +0200, Tim Terlegård wrote: Is there a way to add content without having @@+ in the URL? For instance I'd like the url for adding events to be /addEvent. I get security problems when not having @@+ in the URL. I have this view: browser:page for=zope.app.container.interfaces.IWriteContainer name=addEvent class=.eventforms.EventAddForm permission=zope.ManageContent / When I hit the submit button in this add form I get an error: ForbiddenAttribute: ('add', zope.app.folder.folder.Folder object at 0xb6e65d2c) Forbidden here in the sense that Folder does not have an 'add' attribute. I realize IWriteContainer might not be the right interface, it doesn't have any add method. Should I have for=zope.app.container.interfaces.IAdding instead and somehow add an adapter from IFolder to IAdding or how would I do this? Tim As you point out formlib.BaseAddForm calls the add method of the context: _finished_add = False def add(self, object): ob = self.context.add(object) self._finished_add = True return ob I (also a novice) always use formlib for adding. But I use my own base adding sub-class of BaseAddForm which has this add method: def add(self, obj): try: ob = self.container.add(obj) except: self.container.__setitem__(obj.__name__, obj) ob = self.container[obj.__name__] self._finished_add = True return ob I almost always use a NameChooser to choose the name for the object. So I can trust using __name__ as the dict key. I use self.container here that usually resolves to self.context but on some occassions the context is not the container I want to be adding to. Hopes this helps. Darryl yes, thanks, it helped me but what are we doing wrong here, that the base methods wont work? why should my container know about the add method? any help welcome thanks Dom ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] no object attributes on IObjectAddedEvent / IObjectCreatedEvent?
Florian Lindner schrieb: Am Freitag, 24. November 2006 16:55 schrieb Dominique Lederer: hi just tried to retrive some objects attributes (from an object i created vie ZMI) on the IObjectCreatedEvent. Got just emty attributes, so i tried it with IObjectAddedEvent, but my attributes are still in initial state . it works with IObjectModifiedEvent, but thats not my use-case. is there any other event i have to use to retrieve my attributes after an object has been created? Quotation from a posting from Fred Drake about the same problem: Are you using browser:addform? There are four different attributes that can be used to tailor when attributes of the object are set: arguments, keyword_arguments, set_before_add, and set_after_add. Fields that are input but not included in any of these are set after adding the object to it's container. Regards, Florian thank you both, that helped :) regards Dom ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] changing behaviour of PAU SessionCredentialsPlugin
hi i would like to change the behaviour of extractCredentials in the SessionCredentialsPlugin of the PAU. i´m still fighting a bit with the framework: would i use an adapter for this, or subclassing? or would i use the override directive somehow? thank you Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] changing behaviour of PAU SessionCredentialsPlugin
Dominique Lederer schrieb: hi i would like to change the behaviour of extractCredentials in the SessionCredentialsPlugin of the PAU. i´m still fighting a bit with the framework: would i use an adapter for this, or subclassing? or would i use the override directive somehow? hi, made it by subclassing, just feels good to me at the moment. but there is another question: i´m building a mysql authentification, which should not look up users (in the mysql database) on every request. to do this i write authenticated users PrincipalInfo to a browserid Session. so the user gets authenticated by principalinfo in the session and sometimes (on login for sure, and when an custom timestamp expires) by lookup in the external usertable. this works, but i had to write all the code in the Credentialsplugin, to have access to the request object, which i need for adapting with ISession. My authenticator just passes the principalinfo through. is there any way to get the request object to be accessable in an PAU AuthenticatorPlugin? any other comments on my approach? thanks Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] security problem setting Annotations with an adapter
hi! i just added an adapter to my content-class, which gets and sets some Annotations. at the moment i do this in the adapters init to be able to set them: def __init__(self, context): from zope.security.proxy import removeSecurityProxy self.context = removeSecurityProxy(context) otherwise i get an ForbiddenAttribute: ('__annotations__', my_class object at 0xa6853cec Error whats the right way to tell the zope security policy that setting Annotaions via Adapter is allowed? thanks in advance! cheers Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] how to catalog principal annotations?
hi I have users residing in an external database.I store user data with principal annotations. Now i want to create a view where users with a special annotation are listed. Is it possible to catalog principal annotations and how? Or do i have to create a special Person Class where all principal data is stored on, and connect it somehow to Principals? thanks for your help Dominique ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] how to set predefined values on newly created content object
hello i would like to set predefined metadata, when i create a new content object. from my point of knowledge i could to this with a custom factory or by listening to events. is there any other possibility to to this, mabe somehow in the interface? thanks cheers Dom ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users