Re: [Zope3-Users] Calling createAndAdd with different object id
Am Samstag, 10. September 2005 18:53 schrieb Adam Groszer: > Hello Florian, > > I suggest you download the examples for Philipp's book from > http://worldcookery.com/files/examples-1.0.tgz > Have a look at \examples-1.0\14containers\folder.py. A INameChooser adapter would really be perfect for me. But I need access to the form data of the add form. And AFAIK I don't have this using the NameChooser. You now a way to get the form data in the NameChooser? Thanks, Florian > > Saturday, September 10, 2005, 5:05:26 PM, you wrote: > > Hello, > > I want to override the createAndAdd method mothed in a view class. Since > > I don't want to do all the work I want to derive my class from the > > AddView class from /home/florian/Zope3/src/zope/app/form/browser/add.py. > > The only thing I do in my class is to change the name (object id) of the > > object to be created. In the arguments of the createAndAdd method I have > > not found any information about the id. How can I alter the name? > > > > Thanks, > > > > Florian > > ___ > > Zope3-users mailing list > > Zope3-users@zope.org > > http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Calling createAndAdd with different object id
Am Sonntag, 11. September 2005 03:52 schrieb Alen Stanisic: > I don't think you would do it in AddView. You need to implement an > adapter for your container providing > zope.app.container.interfaces.INameChooser where chooseName() method > will return name for you objects. A INameChooser adapter would really be perfect for me. But I need access to the form data of the add form. And AFAIK I don't have this using the NameChooser. You now a way to get the form data in the NameChooser? Thanks, Florian > Alen > > On Sat, 2005-09-10 at 17:05 +0200, Florian Lindner wrote: > > Hello, > > I want to override the createAndAdd method mothed in a view class. Since > > I don't want to do all the work I want to derive my class from the > > AddView class from /home/florian/Zope3/src/zope/app/form/browser/add.py. > > The only thing I do in my class is to change the name (object id) of the > > object to be created. In the arguments of the createAndAdd method I have > > not found any information about the id. How can I alter the name? > > > > Thanks, > > > > Florian > > ___ > > Zope3-users mailing list > > Zope3-users@zope.org > > http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re[2]: [Zope3-Users] Calling createAndAdd with different object id
Hello Florian, No clue. Next hint is to override the add method of AddView. The default is: return self.context.add(content) Try something like this: self.context[my_id]=content Another hint: self.context.contentName = my_id return self.context.add(content) Have a look at \src\zope\app\container\browser\adding.py and \src\zope\app\container\interfaces.py, IAdding interface. The above are not tested, so... Sunday, September 11, 2005, 11:01:05 AM, you wrote: > Am Samstag, 10. September 2005 18:53 schrieb Adam Groszer: >> Hello Florian, >> >> I suggest you download the examples for Philipp's book from >> http://worldcookery.com/files/examples-1.0.tgz >> Have a look at \examples-1.0\14containers\folder.py. > A INameChooser adapter would really be perfect for me. But I need access to > the form data of the add form. And AFAIK I don't have this using the > NameChooser. You now a way to get the form data in the NameChooser? > Thanks, > Florian >> >> Saturday, September 10, 2005, 5:05:26 PM, you wrote: >> > Hello, >> > I want to override the createAndAdd method mothed in a view class. Since >> > I don't want to do all the work I want to derive my class from the >> > AddView class from >> /home/florian/Zope3/src/zope/app/form/browser/add.py. >> > The only thing I do in my class is to change the name (object id) of the >> > object to be created. In the arguments of the createAndAdd method I have >> > not found any information about the id. How can I alter the name? >> > >> > Thanks, >> > >> > Florian >> > ___ >> > Zope3-users mailing list >> > Zope3-users@zope.org >> > http://mail.zope.org/mailman/listinfo/zope3-users -- Best regards, Adammailto:[EMAIL PROTECTED] -- Quote of the day: To be intoxicated is to feel sophisticated but not be able to say it. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Object Name field on addforms
Hello the auto generated add forms sometimes dispaly a field for the Object Name. add.pt Object Name This is depended if the container implements IContainerNamesContainer: app.py def nameAllowed(self): """Return whether names can be input by the user.""" return not IContainerNamesContainer.providedBy(self.context) I have a Container (implementing IContainer, Interface (via Interface inheritance) and via ZCML IAttributeAnnotatable and IContentContainer. On the auto-generated addform in my layer the Object Name is not shown. Why? Thanks, Florian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Object Name field on addforms
Am Sonntag, 11. September 2005 15:04 schrieb Florian Lindner: > Hello > the auto generated add forms sometimes dispaly a field for the Object Name. > add.pt in src/zope/app/form/browser > > > Object Name > tal:attributes="value context/contentName" /> > > This is depended if the container implements IContainerNamesContainer: > correct: adding.py in zope/app/container/browser > > > def nameAllowed(self): > """Return whether names can be input by the user.""" > return not IContainerNamesContainer.providedBy(self.context) > > I have a Container (implementing IContainer, Interface (via Interface > inheritance) and via ZCML IAttributeAnnotatable and IContentContainer. > > On the auto-generated addform in my layer the Object Name is not shown. > Why? > > Thanks, > > Florian > ___ > Zope3-users mailing list > Zope3-users@zope.org > http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Object Name field on addforms
Am Sonntag, 11. September 2005 15:04 schrieb Florian Lindner: > Hello > the auto generated add forms sometimes dispaly a field for the Object Name. > > add.pt > > > Object Name > tal:attributes="value context/contentName" /> > > This is depended if the container implements IContainerNamesContainer: > > app.py > > > def nameAllowed(self): > """Return whether names can be input by the user.""" > return not IContainerNamesContainer.providedBy(self.context) > > I have a Container (implementing IContainer, Interface (via Interface > inheritance) and via ZCML IAttributeAnnotatable and IContentContainer. > > On the auto-generated addform in my layer the Object Name is not shown. > Why? Another addition: The field is displayed when the addform is called with folder/+/AddCSLink.html. When folder/AddCSLink.html is is not displayed. What is the difference between these two? Unfortunatly when you use the addform directive to register a menu item the action is folder/AddCSLink.html. Can this be changed? Florian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Patterns in Zope3
On Thursday 01 September 2005 14:44, Antonio Beamud Montero wrote: > If I create a Component Client and a component Invoice, > - it's better put all the instances inside se same folder or create two > folders, a folder clients and a folder invoices? There are different approaches: 1. Create Client components living in a Clients folder that can contain invoices. I use this pattern in my book. 2. Create Client components living in a Clients folder that have an attribute called invoices that is a folder. This one is used sometimes in Zope 3 core. 3. Create Client and Invoice components that live in Clients and Invoices folders respectively and create relationship objects linking them to each other. This approach is used by SchoolTool and I like it a lot. You can use SchoolTool's relationship package. > Where I can find patterns in zope 3 design apps? Well, different people use different patterns. It's up to you. 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] Manage application and PAU
On Thursday 01 September 2005 10:05, Paolo Invernizzi wrote: > I want to let that group also access the '++etc++process', and I've > granted the 'Manage Application' to the group, but they are still > not-authorised. That's because ++etc++process does not have a location. In other words, it is not a child of root folder. Thus only global ZCML settings can be made. If you have a good use case, we can consider changing that. 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] Publishing an object specific resource.
On Thursday 01 September 2005 15:04, Alec Munro wrote: > I have what seems like it should be a simple problem: > > I want each of certain types of objects on my site to have certain > files available, accessible like so: > > /home/objectX/somePic.jpg > /home/something/objectY/somePic.jpg > .. > > In my case, the files I want to make available are Flash files, which > load information about whatever object they are made available on. > With Zope 2, acquisition made this a trivial task, and I figure there > must be some easy way to do something similar, but I haven't found it > yet. > > Any leads? Well, one thing to do would be: home/something/objectY/++aquire++/somePic.jpg However, this would break the way Zope 3 does things. somePic.jpg is a resource, so you should register it as a resource and get the URL like this: context/@@/somePic.jpg/absolute_url 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] Function for validation
On Sunday 04 September 2005 12:14, Florian Lindner wrote: > I use a view class for a addform. IIRC there is a defined name for a > function in the view class that is called form zope in order to validate > the input. I thought its name were validate. But in my viewclass > > class AddForm(object): > def validate(): > import pdb > pdb.set_trace() > > Is never called. > > What is its name? No, it's not that easy, because the validate method is never called explicitly. Please study the zope.app.form.browser.add.AddForm class carefully to see how it is done. You will see that the template calls the update() method which in turn does all the validation, value setting, etc. 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] Schemas / Interfaces / Constructor Arguments
On Monday 05 September 2005 10:52, Chris Lehmann wrote: > I've been trying to use the browser:addForm zcml directive to auto > generate forms to add these objects. How do (can I?) specify the > additional arguments to the implementing classes without them actually > being in the schema or must I define a schema for every single object? I would suggest creating two derived interfaces ILocalMusicPlayer and IRemoteMusicPlayer that define the attributes. It should then be easy to use the addform directive tp generate the desired form. 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] ODBC database adapter for Zope3?
On Wednesday 07 September 2005 08:30, Florian Reiser wrote: > I want to use a ODBC database with Zope3. Is there an database adapter > available for it? I remember someone asking recently, but there is none to my knowledge. If you find a Python DB adapter, it would be easy to write the simple Zope 3 wrapper for it. 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] Authentication question
On Wednesday 31 August 2005 17:23, Pete Taylor wrote: > CONFIDENTIAL NOTICE: This email including any attachments, contains > confidential information belonging to the sender. It may also be > privileged or otherwise protected by work product immunity or other > legal rules. This information is intended only for the use of the > individual or entity named above. If you are not the intended > recipient, you are hereby notified that any disclosure, copying, > distribution or the taking of any action in reliance on the contents > of this emailed information is strictly prohibited. If you have > received this email in error, please immediately notify us by > reply email of the error and then delete this email immediately. Based on this confidential notice I cannot answer the question. If I would discover a bug, I could not discuss it with anyone else. I am not giving you free (as in beer and speech) advice, but cannot share the info with other people. Please do not put those notes at the end of public E-mails! I don't care whether they would hold up in court or not, it is just ridiculous. 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] Authentication question
Okay, I am answering this as good as I can, but I will not anymore, if the notice remains. On Wednesday 31 August 2005 17:23, Pete Taylor wrote: > After working through philiKON's web component development book, I decided > to move to zope3.1 (mostly because I wanted to snag the homefolder code, > which of course he also wrote). I don't know which homefolder code you are referring to, but the one in zope.app.authentication was originally developed by myself, with many other contributors thereafter. > In the process of doing this, I decided to > subclass and override some of IPrincipalFolder. Where is this interface? I just searched the trunk for IPrincipalFolder and could not find it. > I create a folder, turn it > into a site, add a pluggableAuthentication utility (non-named), and create > my new principal folder implementation. I can create new principals of my > own type in these folders... (I wanted to use role manager to add some > roles at creation time, rather than explicitly granting them at different > locations through the ZMI). That part seems to be working. > However... > > I can't actually log in with my new user's credentials. If I connect to > specific resources over xmlrpc using my new set of credentials, it works, I > can connect to and modify objects with my new principal. But logging in > over the web fails. I'm using cookieauth, almost line for line from the > web component development book, and it does, if I dump a bunch of debug > statements in, prove to be working as the ILoginPassword interface that's > getting the info when I post up my username/password (as zope_user, > zope_pass). This seems very specific to Philipp's book; you might want to contact him directly. > After some digging, I noticed that in zope.app.security.principalregistry > where it's implementing IAuthentication.authenticate it checks for > __principalsByLogin[login]. That dictionary only ever, for me, contains my > administrative user (when I throw in some print statements to verify). > Since it's called by zope.app.publication in beforeTraversal, that makes > sense that it's only checking local registry, but I don't know how to push > it along to check the next IAuthentication implementation available. > > I may, also, be going about this the wrong way. Any thoughts? I think your setup is so specific that a general list like this will not be of any help. 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] Object Name field on addforms
On Sunday 11 September 2005 09:04, Florian Lindner wrote: > I have a Container (implementing IContainer, Interface (via Interface > inheritance) and via ZCML IAttributeAnnotatable and IContentContainer. > > On the auto-generated addform in my layer the Object Name is not shown. > Why? Because your container does not implement IContainerNamesContainer. 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] Object Name field on addforms
On Sunday 11 September 2005 10:07, Florian Lindner wrote: > The field is displayed when the addform is called with > folder/+/AddCSLink.html. In this case AddCSLink.html is a view for IAdding. > When folder/AddCSLink.html is is not displayed. Here AddCSLink.html is a view of IContainer. > What is the difference between these two? I am surprised both would work. Only the first one should. > Unfortunatly when you use the addform directive to register a menu item the > action is folder/AddCSLink.html. Can this be changed? Don't use the menu/title attributes of form:addform. Use the browser:addMenuItem directive instead. 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] Calling createAndAdd with different object id
On Saturday 10 September 2005 11:05, Florian Lindner wrote: > I want to override the createAndAdd method mothed in a view class. Since I > don't want to do all the work I want to derive my class from the AddView > class from /home/florian/Zope3/src/zope/app/form/browser/add.py. The only > thing I do in my class is to change the name (object id) of the object to > be created. In the arguments of the createAndAdd method I have not found > any information about the id. How can I alter the name? Use INameChooser or implement an alternate __setitem__ method in your container code. 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] Using building blocks for forms
On Friday 02 September 2005 10:56, Florian Lindner wrote: > It would be nice if I can reuse parts of the auto generated form. For > example the error reporting of the fields. Is that possible? Or do I need > to redo everything when using a template? For more pythonic and flexible forms use zc.formlib. 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] write a product keeping the customization of the instances in mind
On Monday 29 August 2005 11:41, Christoph Frick wrote: > as part of the customization of my product by the "end-user" (the admin > that wants to install this software) there is need for a python-script > (or whatever) that basically transforms an uploaded file into a bunch of > objects (parses the file if you wish). > > with our current zope2 ttw app we just force an external method with a > certain name to exist in the root-folder of the product and thats it. > > my goal for the new product is to have only the basic parser (and no > longer the logic for handling the data then). but once somebody wants to > install my product he/she needs to customize this for its needs. > > so basically (thinking in big terms of component based programming - or > at least as far as i thing i understood it): > one needs to write an adapter for my product, so it "adapts" for the > game one wants to represent in its instance. in terms of the good ole OO > - one would subclass my product and override the e.g. upload method. in > terms of design i would consider the approach of an abstract method > upload, that has to be implemented a lot cleaner. I think what you want are wizards. You can create wizards on many levels, including add forms. You could also develop views that are wizards for certain setups. All of those things are not really hard problems. It's just a lot of work, since you have to code the wizard screens. 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
[Zope3-Users] Problem connecting to MySQL
Hello, I'm trying to access a MySQL database through Zope3 but I keep getting an error about encoding: "LookupError: unknown encoding: latin1_swedish_ci" I've tried changing the encoding of the database and the Zope connection object to utf8, among other things, but nothing seems to work. I'm using MySQL 4.1.14-nt, Zope-3.1.0c1 with mysqldbda-1.0.0 installed, and Python 2.4.1. I am able to connect to the database sucessfully afaik because the USE statement seems to work (i.e., there is no error). One thing I am wondering is if the database adapter was installed correctly... all I did was copy the mysqldbda directory to C:\zopeinstance\lib\python and then added the file mysqldbda-configure.zcml to C:\zopeinstance\etc\package-includes. Any ideas? Steve ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Calling createAndAdd with different object id
In INameChooser chooseName(self, name, object) method takes default object name and the object you are adding. Thru this object I would expect you to have access to attributes of your object entered in the objects add form. Unless the fields in your form you need access to are not in your object's schema. If this is the case not sure if you could maybe extend your persistent schema interface with another interface containing your non-persistent fields and somehow have access to those in chooseName(). Haven't tried this though :) Alen On 9/11/05, Florian Lindner <[EMAIL PROTECTED]> wrote: > A INameChooser adapter would really be perfect for me. But I need access to > the form data of the add form. And AFAIK I don't have this using the > NameChooser. You now a way to get the form data in the NameChooser? > > Thanks, > > Florian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Problem connecting to MySQL
Stephen Day wrote: Hello, I'm trying to access a MySQL database through Zope3 but I keep getting an error about encoding: "LookupError: unknown encoding: latin1_swedish_ci" I've tried changing the encoding of the database and the Zope connection object to utf8, among other things, but nothing seems to work. I'm using MySQL 4.1.14-nt, Zope-3.1.0c1 with mysqldbda-1.0.0 installed, and Python 2.4.1. I am able to connect to the database sucessfully afaik because the USE statement seems to work (i.e., there is no error). One thing I am wondering is if the database adapter was installed correctly... all I did was copy the mysqldbda directory to C:\zopeinstance\lib\python and then added the file mysqldbda-configure.zcml to C:\zopeinstance\etc\package-includes. Any ideas? The problem seems that the adapter use connection.character_set_name()... Try use Zope-3.1.0c2 and mysqldbda from svn trunk http://svn.zope.org/mysqldbda/trunk/ then you can set connection encoding manually. -- Dmitry Vasiliev (dima at hlabs.spb.ru) http://hlabs.spb.ru ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users