Creating a ZClass which includes Image base class
Can someone provide a newbie with a road-map for accomplishing the following task? I'm at the bottom of the learning curve looking far, far up. My goal is to be able to: go into the ZMI and add a "WebArticle". A WebArticle object contains the text and images for a complete print-magazine-style Web feature. It most importantly contains: - Headline - Deck (sub-headline text) - Body copy (the main text of the article) - Large Image (to accompany the article) - Small Image (to accompany "teasers" for the article) The full WebArticle will serve as the main content for a Web page, and I hope to use a subset of the Headline, Deck, and Small Image on the site's front page in a listing of available articles. Where I'm currently stumped is how to create a ZClass for the WebArticle which, upon instantiation, accepts the above text fields as well as enables the upload of the images. (I'm not afraid of trying to create a Python class, I've had some OO programming classes in C++. But if Python classes are not for steaming newbies, forget it.) I know I'm missing something big, but here's how far I've gotten: I've created a Zope product, and within it created a ZClass including a Zope Image base class. I created a property sheet that includes the text fields, added a View to the class which accesses the property sheet. (Basically, I've followed The Zope Book: Extending Zope chapter on Creating a ZClass). When I instantiate a WebArticle, it accepts an ID, but when I click Add, I get a "File not found" error. Further, I have no idea how the Image Upload functionality will come in. I'm not necessarily asking for step-by-step hand-holding or exact code, but I need some direction on how to create this object / functionality. I realize that I don't understand how Zope works. If my proposed solution for my goal is off-target, please let me know! I greatly appreciate any time you can take to help a newbie get a toe-hold on this great big thing called Zope. Thanks, Jon Jon Whitener Webmaster & On-line Editor Time Warner Cable Michigan webmaster@twmi.rr.com
On Mon, Sep 23, 2002 at 08:52:29PM -0400, Jon Whitener wrote:
When I instantiate a WebArticle, it accepts an ID, but when I click Add, I get a "File not found" error. Further, I have no idea how the Image Upload functionality will come in.
Sounds like your zclass is trying to *be* the image and it wants a file upload as soon as you create it. It's probably trying to upload a file from your hard drive with the ID you give. Either that, or it's calling manage_addImage() with an incorrect argument. Either fix that problem, or Instead use Folder as your base class. That way, your WebArticle is not an image; it contains an image. Then, on one of your forms, you can just copy the ZMI page for adding an Image, and have it put the image inside your new WebArticle (Folder). The body text could then be e.g. a DTML Method inside the folder. -- Paul Winkler "Welcome to Muppet Labs, where the future is made - today!"
Jon Whitener writes:
My goal is to be able to: go into the ZMI and add a "WebArticle". A WebArticle object contains the text and images for a complete print-magazine-style Web feature. It most importantly contains:
- Headline - Deck (sub-headline text) - Body copy (the main text of the article) - Large Image (to accompany the article) - Small Image (to accompany "teasers" for the article) Make your ZClass "folderish" (derive from ObjectManager) and put all your objects as content into the Z Instances.
Dieter
On Tue, Sep 24, 2002 at 09:35:50PM +0200, Dieter Maurer wrote:
Jon Whitener writes:
My goal is to be able to: go into the ZMI and add a "WebArticle". A WebArticle object contains the text and images for a complete print-magazine-style Web feature. It most importantly contains:
- Headline - Deck (sub-headline text) - Body copy (the main text of the article) - Large Image (to accompany the article) - Small Image (to accompany "teasers" for the article) Make your ZClass "folderish" (derive from ObjectManager) and put all your objects as content into the Z Instances.
D'oh! That's what I meant. Derive from ObjectManager, not Folder. -- Paul Winkler "Welcome to Muppet Labs, where the future is made - today!"
participants (3)
-
Dieter Maurer -
Jon Whitener -
Paul Winkler