Re: [Zope-dev] ZPatterns and SQL
Hi!
So as the item is an instance of my ZClass containing also an company_name attribute it will always return the item and because of that the Rack thinks it's already there. So why is this happening? What do I need to change?
You need to use an attribute which the object has *if and only if* it exists in the database. If the class has the attribute defined, all instances exist, and you can't even load it with SkinScript because ZPatterns uses __getattr__ to redefine attributes, and that doesn't work if the attribute already exists in the class.
So I shouldn't define it inside the ZClass propertysheet? Do I understand this right? (I remember having problems when using properties not defined in a sheet somewhere.. or am I mistaken completely somehow? ;-)
When changing the loadAttrib to something else (non existing), the newItem is working but instead getItem is not working anymore as it returns None only.. (somehow the zsql method is not even called thus the skinscript seems not to work in that case (I guess because the loadAttrib is not defined in it somewhere)).
Right. The load attribute has to be one defined in a provider, and which will end up being "NOT_FOUND" if the object doesn't exist in the table you're querying.
I will experiment a little with this information. Hope it helps :) Thanks! -- christian -- COM.lounge http://comlounge.net/ communication & design info@comlounge.net
At 05:29 PM 2/19/01 +0100, Christian Scholz wrote:
You need to use an attribute which the object has *if and only if* it exists in the database. If the class has the attribute defined, all instances exist, and you can't even load it with SkinScript because ZPatterns uses __getattr__ to redefine attributes, and that doesn't work if the attribute already exists in the class.
So I shouldn't define it inside the ZClass propertysheet? Do I understand this right? (I remember having problems when using properties not defined in a sheet somewhere.. or am I mistaken completely somehow? ;-)
You can't do this with a load attribute, because a default value will exist. The easiest way to deal with this is simply to have a seperate attribute name just for loading, or use an attribute that isn't on a property sheet.
Hi all, I hope I am not posting this to the wrong newsletter, I am seeking some advice regarding using zope on my organizations site.. I am creating a Developers Recouse Community site, which will have a lot of features, I was hoping someone may be able to point me in the direction to accomplishing these.. These are the sections that I am currently planning :- a) A structural database of articles/tutorials on different subjects. b) Forums, Members Area (high emphasis on the members area, I really need to add features and customize this area) Possible File directory, i.e Freshmeat type thing c) Job Board, A complex job resume posting and employer front end job board. possibly with an emplyer login area, not sure whther to give same access to standard members. As a nebie to Zope/DTML/Python these tasks seem a little daunting to me - I am aware of existing products like ZopePTK and was wondering whether this would provide good ground for such a site as above. Please let me know your comments/suggestion - they will be greatly appreciated. Thank You. John
participants (3)
-
cs@comlounge.net -
John Bennett -
Phillip J. Eby