Table of Contents

Class: Obj oops/core.py

Persistent object class.

Assigning units to Obj subclass attributes makes those attributes persistent on instances of that Obj subclass. The reason for this is that units intercept operations on their namesake attribute and instead of storing the attribute's value in the instance's namespace, it is stored in the database.

For those who have designed tables in SQL, this will feel very much like a python SQL with the added bonus of adding methods to your tables:

                >>> class Client(Obj):
                ...             name = Text(80)
                ...             address = Text(100)
                ...             phone = Text(25)
                ...             def __init__(self, name="", address="", phone=""):
                ...                     "Constructor"
                ...                     if name: self.name = name
                ...                     if address: self.address = address
                ...                     if phone: self.phone = phone
                ...             def __repr__(self):
                ...                     "Python hook for visual representation of data"
                ...                     return "Name:%s\nAddress:%s\nPhone:%s"%(
                ...                                     self.name, self.address, self.phone)
                ...
                >>> myclient = Client("My Client", "123 Main Str.", "(555)555-5555")
                >>>    print myclient
                Name: My Client
                Address: 123 Main Str.
                Phone: (555)555-5555

Base Classes   
Node
    object
Methods   
__clear__
__copyfrom__
__init__
__moveto__
  __clear__ 
__clear__ ( self )

Recursively delete all data stored under this node.

Overloaded to take into account non-empty unit rows

  __copyfrom__ 
__copyfrom__ ( self,  other )

Make `self` a copy of `other`.

Overloaded to take into account non-empty unit rows

  __init__ 
__init__ (
        self,
        copyfrom=None,
        **keywords,
        )

Constructor.

Arguments:

copyfrom
if specified, it is the initial argument for the __copyfrom__ method.
  __moveto__ 
__moveto__ (
        self,
        database,
        path=(),
        parent=None,
        )

Move node to new location.

Overloaded to take into account non-empty unit rows.


Table of Contents

This document was automatically generated on Mon Feb 18 01:32:24 2002 by HappyDoc version 2.0.1