Zope
  Home arrow Zope arrow Page 2 - Creating Zope Products
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
IBM Rational Software Development Conference
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ZOPE

Creating Zope Products
By: Peyton McCullough
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 13
    2006-03-07

    Table of Contents:
  • Creating Zope Products
  • The Stuffing
  • Inner Mechanisms
  • Finishing Touches

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    Virtual Tradeshows by Ziff Davis Enterprise - A Unique Opportunity to Connect with IT Experts, Access Information, and Gain Insight on today's Technology

    Creating Zope Products - The Stuffing
    (Page 2 of 4 )

    The first thing we'll need to do is create an __init__ method. The purpose of this is to accept attributes when an instance of our Product is created. In this example, we'll accept the attributes id, title and nickname:

       ...

       def __init__(self, id, title, nickname):
          "Initialization."
          self.id = id
          self.title = title
          self.nickname = nickname

    We can now add actual content to our Product. The methods that we create will be available as separate pages in our Product. These pages can be accessed by attaching the associated method's name to the id of the Product instance in a request (for example, http://localhost/instance/methodOne). We'll start with index_html, the default page that's called when nothing is specifically requested:

       ...

       def index_html(self):
          "Default page."
          out = '<html><head><title>' + self.title +
    '</title></head><body>'
          out = out + 'Hello, I am ' + self.title + ', but my friends
    call me ' + self.nickname + '.'
          out = out + '</body></html>'
          return out

    In the above method, we return a page that displays the instance's title and the value of the nickname attribute we accepted in the __init__ method earlier. Let's add one more method that lists data about an instance:

       ...

       def list_info(self):
          "A list of information."
          out = '<html><head><title>' + self.title +
    '</title></head><body>'
          out = out + '<b>ID:</b> ' + self.id
          out = out + '<br /><b>Name:</b> ' + self.title
          out = out + '<br /><b>Nickname:</b> ' + self.nickname
          out = out + '</body></html>'
          return out

    More Zope Articles
    More By Peyton McCullough


       · Hey, all,This article focuses on creating Zope products. In my experience, they...
       · Hi,I think you should also mention the security definitions. They are really a...
     

       

    ZOPE ARTICLES

    - Creating Zope Products
    - Plone Content Types With Archetypes
    - Flat User Management in Zope
    - Creating Basic Zope Applications
    - Getting started with Zope for Linux and Sola...
    - ZPT Basics (part 4)
    - ZPT Basics (part 3)
    - ZPT Basics (part 2)
    - ZPT Basics (part 1)
    - Exception Handling In DTML
    - DTML Basics (part 4)
    - DTML Basics (part 3)
    - DTML Basics (part 2)
    - DTML Basics (part 1)
    - Using Zope With Apache

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway