I want to create a new type of folder that, when created, brings some specific properties and contents along with it. I presume I will want to use a ZClass for this, but given all the warnings I've received about their relative fragility, I wanted to check with the list to be sure I'm not either overlooking a better solution or acting in ignorance of a packaged solution.
I want to create a new type of folder that, when created, brings some specific properties and contents along with it.
A simple python product will do. Just subclass it to OFS.Folder.Folder and stick in your manage_afterAdd() (when using manage_afterAdd(), note a previous list email about using this for ZPT by me)
I presume I will want to use a ZClass for this, but given all the warnings I've received about their relative fragility, I wanted to check with the list to be sure I'm not either overlooking a better solution or acting in ignorance of a packaged solution.
ZClasses are suitable for less serious classes. Try to go for python product first and foremost if you can. Peter
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
--- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 2002-05-07
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 2002-05-07
At 06:43 PM 6/2/2002 +0100, Peter Bengtsson wrote:
I want to create a new type of folder that, when created, brings some specific properties and contents along with it.
A simple python product will do.
Is there such a thing? :-) I just spent four hours with Chapter 3 of ZDG to learn how to create Python products for use in Zope. This makes Smalltalk look like a walk in the park! And I didn't even get as far as subclassing OFS.Folder.Folder or thinking about manage_afterAdd(). That chapter has so many typos and apparently out-dated information in it -- much of which has been noted in the file but not yet fixed, apparently -- that a newbie like me stands zero chance of understanding how to create a meaningful Zope product in Python. Maybe I'm just allowing myself to be intimidated here, but I don't think so. It is starting to feel like Zope is object-oriented but buries its extensibility so deeply that either the process is too complex (as with Python products) or underexposed (as with ZClasses) so that really *using* its object orientation is daunting for all but the most intrepid and savvy of Pythonistas and Zopistas. Obviously, at least some of you folks on this list grok how to do this object-oriented Web app development in Zope (which I thought was its main strength and is the sole reason I dove into it) but figuring it out has, for me, been a gradual process of tooth extraction without benefit of anesthetic. I'm on the edge of just giving up. Zope appears to be very strong for building object-oriented dynamic Web *sites* but not for creating Web services or applications. Am I wrong here? SOmeone please unlock this door for me if it can be unlocked. Alternatively, confirm my worst fears and I'll just find other ways to build these things I need to create.
Just subclass it to OFS.Folder.Folder and stick in your manage_afterAdd() (when using manage_afterAdd(), note a previous list email about using this for ZPT by me)
I presume I will want to use a ZClass for this, but given all the warnings I've received about their relative fragility, I wanted to check with the list to be sure I'm not either overlooking a better solution or acting in ignorance of a packaged solution.
ZClasses are suitable for less serious classes. Try to go for python product first and foremost if you can.
Peter
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
--- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 2002-05-07
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 2002-05-07
On Sun, Jun 02, 2002 at 05:38:12PM -0700, Dan Shafer wrote:
A simple python product will do.
Is there such a thing? :-)
All my Python products derive from Maxm's mxmSimpleItem and mxmObjectManager classes (http://zope.org/Members/maxm/easyProduct). Takes quite a bit of the learning curve out of making custom Zope products. And the documentation is doubtlessly more current and accurate. -- Mike Renfro / R&D Engineer, Center for Manufacturing Research, 931 372-3601 / Tennessee Technological University -- renfro@tntech.edu
On Sun, 2002-06-02 at 20:38, Dan Shafer wrote:
That chapter has so many typos and apparently out-dated information in it -- much of which has been noted in the file but not yet fixed, apparently -- that a newbie like me stands zero chance of understanding how to create a meaningful Zope product in Python.
Pointers to this outdated info and these typos in the form of comments to that chapter would be appreciated. BTW, I presume you mean developer-contributed comments when you say "noted in the file"? I don't understand how this is a bad thing. Yes, there are inconsistencies in the documentation, but isn't it better to be able to read them inline than to have each reader rediscover them fresh, given that we (ZC) really haven't been provided with the resources to update the canonical docs in some time?
Zope appears to be very strong for building object-oriented dynamic Web *sites* but not for creating Web services or applications.
Am I wrong here? SOmeone please unlock this door for me if it can be unlocked. Alternatively, confirm my worst fears and I'll just find other ways to build these things I need to create.
What are you trying to build and specifically what isn't working for you? - C
At 12:13 AM 6/3/2002 -0400, Chris McDonough wrote:
On Sun, 2002-06-02 at 20:38, Dan Shafer wrote:
That chapter has so many typos and apparently out-dated information in it -- much of which has been noted in the file but not yet fixed, apparently -- that a newbie like me stands zero chance of understanding how to create a meaningful Zope product in Python.
Pointers to this outdated info and these typos in the form of comments to that chapter would be appreciated.
I have made several such comments in the document itself and will continue to do so.
BTW, I presume you mean developer-contributed comments when you say "noted in the file"?
Yes
don't understand how this is a bad thing.
The notes aren't a bad thing. It just seemed like quite a few of them raise issues that aren't resolved in any edits to the text but which don't contain answers in themselves, so if you don't know what the answer is, you're sort of stuck. For examples: On page 5, "XXX is this true? I thought that any ExtensionClass.Base can be acquired. The Implicit and Explicit just control how the class can acquire, not how it *is* acquired." I have no idea what that means, but it makes me wonder if the code examples that use Acquisition.Implicit, e.g., are going to work. And if they don't, how would I know? On page 11, there is a set of comments about stuff related to Registrar, but as far as I can tell, no resolution. On page 12, following the addForm() function listing there is some discussion about changes the code may need, but nothing definitive from the author(s) of the text to indicate if those corrections are right, or whether the 2.4 stuff also applies to 2.5, etc. IOW, what I'm saying in brief is that for someone like me, who is a decent but not world-class Python coder who is very comfortable creating Web *sites* with dynamic pages in Zope/DTML and who is a fairly experienced object thinker and designer, the docs are just confusing enough at key points to make it very difficult to know what to do. Since many of these comments go back to last fall, I just sort of hoped that someone in authority would by now have gone through them and responded, fixed things, etc. As it is, the document is perhaps just a bit too "raw" for someone of my experience level.
Yes, there are inconsistencies in the documentation, but isn't it better to be able to read them inline than to have each reader rediscover them fresh, given that we (ZC) really haven't been provided with the resources to update the canonical docs in some time?
Yes. And I really do understand that updating this doc is probably not a high priority at ZC. But where we have user-supported Open Source software, the absence of any clear source of knowledge and support for this process is a major obstacle to success for people like myself. (Again, let me say it clearly: I love Zope and Python. I do not *want* to give them up or learn other tools and platforms if I can avoid it. And I have worked harder at mastering Zope than any other platform I've approached in the past 7 or 8 years. But for whatever reason, things just don't "click" for me.)
Zope appears to be very strong for building object-oriented dynamic Web *sites* but not for creating Web services or applications.
Am I wrong here? SOmeone please unlock this door for me if it can be unlocked. Alternatively, confirm my worst fears and I'll just find other ways to build these things I need to create.
What are you trying to build and specifically what isn't working for you?
Well, there are quite a number of projects and I don't want to clutter the list with specs. One of the projects I ended up figuring out how to do without creating a product, by making extensive use of Python scripts and built-in Zope objects (folders and DTML documents/methods). I don't like the factoring I ended up with and I may re-do it at some point, but for now it seems to be working. On that one, however, I set out and spent a *lot* of time trying to make it first as a product using ZClasses because I think in terms of objects. Several people in the Zope community warned me *not* to use ZClasses for anything more than very simple-minded stuff. This particular conversation arose from a request I made asking how I could create a new type of folder object. I have a repetitive process in which I create a new folder (or copy an existing one in another case), give it some content that varies only slightly from folder to folder, create a document inside that folder, give it some content that varies only slightly from document to document. It struck me that if I could somehow subclass a Zope folder so I could just add a new folder with the new material in place and apply some Python scripting, I could save myself a bunch of time. So I set out only to learn how to make a new *type* of folder. I figured a ZClass would work. I was advised to create a "simple Python product" instead. In trying to do so, I was working my way through the ZDG Chapter 3 stuff and finding the issues I raised above. I was also finding that there seems to be no such thing as a "simple" Python product. To its credit, the first page of Chapter 3 of the ZDG warns about this. "In comparison with through the Web products [by which I assume is meant Zope products using ZClasses], filesystem products (presumably relying on Python) require more overhead to build." That turns out to be a major understatement in my efforts so far to create a Python Product.
- C
On page 5, "XXX is this true? I thought that any ExtensionClass.Base can be acquired. The Implicit and Explicit just control how the class can acquire, not how it *is* acquired." I have no idea what that means, but it makes me wonder if the code examples that use Acquisition.Implicit, e.g., are going to work. And if they don't, how would I know?
I see these comments. They actually aren't supposed to be there and I will delete them. Please ignore the comments that make you queasy for now.
This particular conversation arose from a request I made asking how I could create a new type of folder object. I have a repetitive process in which I create a new folder (or copy an existing one in another case), give it some content that varies only slightly from folder to folder, create a document inside that folder, give it some content that varies only slightly from document to document. It struck me that if I could somehow subclass a Zope folder so I could just add a new folder with the new material in place and apply some Python scripting, I could save myself a bunch of time. So I set out only to learn how to make a new *type* of folder. I figured a ZClass would work. I was advised to create a "simple Python product" instead. In trying to do so, I was working my way through the ZDG Chapter 3 stuff and finding the issues I raised above. I was also finding that there seems to be no such thing as a "simple" Python product. To its credit, the first page of Chapter 3 of the ZDG warns about this. "In comparison with through the Web products [by which I assume is meant Zope products using ZClasses], filesystem products (presumably relying on Python) require more overhead to build." That turns out to be a major understatement in my efforts so far to create a Python Product.
If you have a specific question about how to create a Product, there are plenty of folks here who will be happy to help you. You could of course use a ZClass also. - C
At 04:45 PM 6/3/2002 -0400, Chris McDonough wrote:
On page 5, "XXX is this true? I thought that any ExtensionClass.Base can be acquired. The Implicit and Explicit just control how the class can acquire, not how it *is* acquired." I have no idea what that means, but it makes me wonder if the code examples that use Acquisition.Implicit, e.g., are going to work. And if they don't, how would I know?
I see these comments. They actually aren't supposed to be there and I will delete them. Please ignore the comments that make you queasy for now.
OK, I will. Thanks.
If you have a specific question about how to create a Product, there are plenty of folks here who will be happy to help you. You could of course use a ZClass also.
That's what I started out to use on a couple of projects but I had several people on this list warn me that ZClasses are not very robust, are quite difficult to use and perhaps even buggy. I was warned not to use them except for fairly toy-sized apps. Was that too harsh a judgement? Back when I was deciding what Web development platform to "bet on" for my future application work, I spent a LOT of time looking at options. I settled on Zope principally because it used Python (which I didn't yet know but which I could see from my background was going to be a very approachable and clean language to use) and because it was object-oriented and extensible using ZClasses. Zope has been very satisfying for all of the site development work I've done but I've tried three different applications, ranging from moderately complex to what seemed to me to be simple, and it has just refused to yield success. In the first case, I was able to find what I'd call a satisfactory workaround, using built-in Zope objects and muscling them around with brute force in Python scripts. But it doesn't feel very object-oriented at all and I'm not feeling like the solutions are at all elegant. Perhaps it's just that my expectations of Zope were too grandiose. And now I've spent so much time trying to master it that I hate to start learning something else. But as helpful as this list can be, sometimes I think maybe I'm just in over my head.
- C
That's what I started out to use on a couple of projects but I had several people on this list warn me that ZClasses are not very robust, are quite difficult to use and perhaps even buggy. I was warned not to use them except for fairly toy-sized apps. Was that too harsh a judgement?
They're fine for things like this, I think. I would personally use a Python product, but that is a decision based on my own purely subjective point of view.
Perhaps it's just that my expectations of Zope were too grandiose. And now I've spent so much time trying to master it that I hate to start learning something else. But as helpful as this list can be, sometimes I think maybe I'm just in over my head.
Rome wasn't built in a day. ;-) All I can do is encourage you to stick it out. I think you should probably describe your actual nuts-and-bolts problems a little better to the list so folks can help. It's difficult to provide any constructive feedback on the problems as you've explained them so far. HTH, -- Chris McDonough Zope Corporation http://www.zope.org http://www.zope.com "Killing hundreds of birds with thousands of stones"
At 06:09 PM 6/3/2002 -0400, Chris McDonough wrote:
Rome wasn't built in a day. ;-) All I can do is encourage you to stick it out. I think you should probably describe your actual nuts-and-bolts problems a little better to the list so folks can help. It's difficult to provide any constructive feedback on the problems as you've explained them so far.
Yeah, I agree. In past weeks, I have submitted quite detailed descriptions of my designs and issues to the list. I just felt like I am wearing out my welcome a bit and that maybe I just need to go off into a dark cave with just me, Zope and an Internet connection for about three months and then emerge an expert. :-)
HTH,
-- Chris McDonough Zope Corporation http://www.zope.org http://www.zope.com "Killing hundreds of birds with thousands of stones"
welcome a bit and that maybe I just need to go off into a dark cave with just me, Zope and an Internet connection for about three months and then emerge an expert. :-)
Dan, Don't get discouraged. <g> You can download and install FreePM or email me privately and I will give you access to the demo site. http://www.freepm.org:8080/freepm_download It is a medical records application. It isn't pretty (I'm not a graphics person) but it does work and it is built with ZClasses. The demo doesn't have the latest changes I made where I finally figured out how to move all of the code into the Product to make upgrading a site easier. But, you can browse through the ZClasses and maybe I can answer a few questions for you. Everything I learned about how to make them work is in the list archives and How-To's. BTW: The only thing I wasn't able to do with ZClasses was get the performance I wanted/expected. I also want to overload a couple of the ZODB classes so that I can create my own audit trails. So, I am moving to a Python based Product. I hope I can accomplish that since products are loaded last. No, it wasn't easy to understand how to write a Python Product, it was easy to 'do'. May I even say that it is simpler than it sounds? But, search the Zope site for 'minimal' there are two How-To's and then look at the code for a couple of the other smaller products like BTreeFolder or CookieCrumbler. Cheers, Tim
It seems like perhaps I can accomplish what I want to do without subclassing folder. I can presumably write a Python script that I run instead of adding a special type of folder to the site. The script would create the folder and/or document(s) I need, set their properties, define their content. This is not a very object-oriented or reusable solution but it seems workable. Maybe my problem with Zope is that I so want it to behave in a purely OO way that I struggle against its natural order and structure. I would welcome insights and thoughts about that.
Dan - for what it's worth, here's how my zope product learning curve went. I probably had it easier than some - there was an existing product that was quite similar to mine - DTML Document. I copied this, changed the meta_type, and got it showing up in the ZMI etc. Then I started making modifications, tackling problems and gradually learned more about how it worked. I've kept doing that ever since. When I hit problems I would search for insights in the docs and would learn something, but never used them as my main guide (the books didn't exist then). I would also search the lists for clues (these days I would probably turn to #zope first). I didn't have a really usable debug setup until recently (using ZEO). I would say this is a must, or failing that at least set up a comfortable way to print debug messages. When testing/debugging you end up using a complex cocktail of web browsers/code windows/editors/server control windows and you need to develop a feel for when things need refreshing, when you are really not looking at the code you thought you were because of a syntax error, etc. It's still often frustrating, and makes me miss the relative simplicity of smalltalk, but for now I don't see any other platform providing what zope does, as well as it does. Cheers, -Simon
participants (6)
-
Chris McDonough -
Dan Shafer -
Mike Renfro -
Peter Bengtsson -
Simon Michael -
Tim Cook