Re: [Zope3-Users] There isn't enough context to get URL information.
On Thu May 25 2006 05:50, Achim Domma wrote: I try to figure out how to make attributes holding content objects accessible via the browser. I'm working on the same thing, but I don't know how to make a view for the contents of the containers in the ZMI. I have an Item object with 'prices' and 'options' attributes that are both BTreeContainer. I'd like to have two menu items for Item (named Prices and Options) and have each display the contents of the respective attribute. How can I do that? -- Ron ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] New annotations factory problems
On Wed May 24 2006 07:00, Martijn Faassen wrote: Ron Bickers wrote: I was trying to implement the new annotations factory in zope/annotation/README.txt but I'm getting a ForbiddenAttribute __annotations__ error when I try to view an editform for the annotations. Before, I had configured a trusted adapter, but since (I think) an adapter directive is not needed for this, I don't know how to make it trusted or otherwise fix the problem. Any ideas? These annotations still get registered using the adapter statement: adapter factory=.my.annotationfactory trusted=true / I tried this, but I'm still having trouble. Perhaps I'm missing something simple. I have the following: An IItem interface and a class Item implementation that's attribute annotatable. The annotation interface and class are as follows: class IItemMiscInfo(Interface): inStock = Bool( title=uIn Stock, description=uIs item in stock?, default=True) class ItemMiscInfo(Persistent): implements(IItemMiscInfo) adapts(IItem) def __init__(self): self.inStock = True What am I supposed to use in the adapter directive as the factory? If I put .item.ItemMiscInfo, I get TypeError: Missing 'provides' attribute when starting Zope. If I add provides=.interfaces.IItemMiscInfo, I get the following error when trying to access the editform: File /usr/lib/zope-3.3.0_beta1/lib/python/zope/security/adapter.py, line 84, in __call__ adapter = self.factory(*args) TypeError: __init__() takes exactly 1 argument (2 given) The README says to do this: zope.component.provideAdapter(zope.annotation.factory(Item)) I can do that in a debug session and it works as expected, I just can't figure out the rest. What am I missing? -- Ron ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] New annotations factory problems
On Wed May 24 2006 16:42, Tom Dossis wrote: File /usr/lib/zope-3.3.0_beta1/lib/python/zope/security/adapter.py, line 84, in __call__ adapter = self.factory(*args) TypeError: __init__() takes exactly 1 argument (2 given) I haven't been following this thread, however from the error message it appears your adapter is missing the context (adaptee)... def __init__(self, context): # context is the IItem object to be adapted. The README says the following: Note that the annotation implementation does not expect any arguments to its `__init__`. Otherwise it's basically an adapter. And the example is defined as follows: class Bar(Persistent): interface.implements(IBar) component.adapts(IFoo) def __init__(self): self.a = 1 self.b = 2 That's why I didn't think the adapter directive would do the right thing, but all of this (Zope 3) is pretty new to me, so what do I know. -- Ron ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] New annotations factory problems
On Wed May 24 2006 17:00, Tom Dossis wrote: Did you try something like... ? MyFactory=factory(ItemMiscInfo) And corresponding zcml.. adapter factory=.mymodule.MyFactory It's like magic! Everything is working perfectly, now. Thank you! -- Ron ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Two content objects' simultaneous adding
On Mon May 22 2006 20:11, Tom Dossis wrote: Ok. So now I'm wondering... what's the point in using createObject if I can just create an object the Python way? I guess createObject could be useful in an example such as a generic add-objects menu. In this scenario it's probably be easier to deal with factory names. Otherwise I can't see why you shouldn't do it the python way if it's more direct/explicit. So is it true then, if I have a class: class MyObject(object): ... And a factory defined in ZCML: class class=.MyObject factory id=me.MyObject description=Create a new MyObject / /class MyObject() and createObject(me.MyObject) will do the same thing and create the same object? If I recall from Zope 2 development, you couldn't just do the former, but it's been awhile and I remember just enough to taint my mind when working in Zope 3. Thanks! -- Ron ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Two content objects' simultaneous adding
On Sat May 20 2006 04:47, baiju m wrote: I have two content objects (both are containers) but I cannot add one to another as give here : def create(self, data): square = Square() square.name = data['name'] square.description = data['description'] company = Company() company.name = data['companyname'] company.description = data['companydescription'] square['Comp1'] = company ... return square It was working in 3.2, now NotYet error is coming in 3.3. Here is the traceback: I did this very thing a couple days ago in 3.3 and it works for me, except that I'm using zope.app.zapi.createObject to create the instances of my content objects. So, maybe this: from zope.proxy import removeAllProxies from zope.app.zapi import createObject def create(self, data): square = removeAllProxies(createObject(uname.of.your.Square.Factory)) square.name = data['name'] square.description = data['description'] company = removeAllProxies(createObject(uname.of.your.Company.Factory)) company.name = data['companyname'] company.description = data['companyanydescription'] square['Comp1'] = company ... return square I'm not sure if/why the removeAllProxies is needed as I stole this procedure from the list archives. Also, I'm about 1 week into my Zope3 development experience, so don't just take my word for it even if it works. :-) -- Ron ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] New annotations factory problems
I was trying to implement the new annotations factory in zope/annotation/README.txt but I'm getting a ForbiddenAttribute __annotations__ error when I try to view an editform for the annotations. Before, I had configured a trusted adapter, but since (I think) an adapter directive is not needed for this, I don't know how to make it trusted or otherwise fix the problem. Any ideas? -- Ron ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Install problem with Zope 3.2.1
On Fri April 7 2006 05:24, Kim L. Jacobsen wrote: I tried installing Zope 3.2.1. configure worked ok, but when ran make I got the following: I'm using Gentoo Linux and python 2.4.2. I can't help with the error, but Zope 3 is in Portage and can be installed with a simple 'emerge zope' if you put net-zope/zope in package.keywords. Zope 3.2.1 isn't there yet, only 3.2.0. However, making a 3.2.1 ebuild overlay is simple enough and works for me. -- Ron ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Re: Please Guido, pick me, pick me!
On Thu February 2 2006 16:05, Stephan Richter wrote: Yeah, but honestly I don't care. If people choose a technology on name recognition and not on technical merit, then it is their bad. However, I question the RoR hype. I wonder whether big companies seriously considering it; it has absolutely no track record. Zope 2 (and even 3) on the other hand is deployed on many huge sites and the risk of deploying it is low. Even deploying Zope 3 is a smaller risk than RoR. It's hard to choose Zope 3 based on technical merit when it's not well-known that it's so different than the Zope 2 merits they've already decided they didn't like. I've been using Zope since 1998, mostly because I loved Python programming and it just fit me. I was excited to see Zope 3 in the works a few years ago, but frankly I didn't understand half of what the developers were talking about when they discussed what it was going to look like; it was over my head (and still is a bit), but I could tell it would be a different beast. I figured I'd wait and see and happily continue using Zope 2. Today, I see the mess that a Zope 2 site can turn in to, so I started looking at Zope 3 again. The release announcements say it's ready for production use, but the website has no promotion of it whatsoever. You have to dig several levels deep to see any mention that it's not just a new version of Zope. The downloads page makes it look like nothing more than an upgrade and the one Zope 3 link under Developers says the wiki is for Zope 3 development itself, not for those that want to use it. I do have Richter's book (thank you, Stephan) and Philipp's book is on its way, but I'm having trouble finding any material online that isn't a hodge-podge of years old development notes. I know Zope 3 is young, but this surprises me. I would think ZC would at least want to mention their new production-ready killer app on the front page, and perhaps include *something* in the What is Zope? page. But there's not one word about Zope 3's new technical merits. There must be a good reason for this. I know they didn't spend all this time building a great open source product for members-only. The only thing I can think of is that perhaps they don't want to promote it while Zope 2 product compatibility isn't there yet. With so many nice Zope 2 products around, I can see new users getting frustrated that none of them work in Zope 3. Once some major Zope 2 products work in Zope 3, maybe things will change. At any rate, I look forward to learning about Zope 3. I hope it's as fun (or more) to work with as Zope 2 has been. -- Ron ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users