| Server IP : 182.53.201.61 / Your IP : 216.73.217.175 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/system-config-network/netconfpkg/ |
Upload File : |
Ñò
:®Jc @ sÀ d Z d d k Z d d k l Z l Z d „ Z e d „ ƒ Z e d „ ƒ Z d e f d „ ƒ YZ d
e f d „ ƒ YZ d e f d
„ ƒ YZ
d e e f d „ ƒ YZ e Z
e Z e Z d S( s" Basic classes with predefined properties
Example usage:
class Article(Gdtstruct):
"A basic Article class"
# fields and types are dynamically set by the initializer
gdtstruct_properties([('title', Gdtstr, "The Title of the Article"),
('page', Gdtlist, "List of pages in the Article")
])
def __init__(self, *args):
super(Article, self).__init__(*args)
self.title = Gdtstr("")
self.page = Gdtlist()
class Page(Gdtstruct):
# fields and types are dynamically set by the initializer
gdtstruct_properties([('text', Gdtstr, "The text of the page"),
])
def __init__(self, *args):
super(Page, self).__init__(*args)
self.text = Gdtstr(args[0] if len(args) else "")
a = Article()
print Article.title.__doc__
print
a.title = "My title"
a.page.append(Page("page 1"))
a.page.append(Page("page 2"))
a.commit()
print a
print
a.title = "My bad title"
a.page[1].text = "bad page 2"
a.page.append(Page("bad page 3"))
print a
print
a.page.rollback()
print a
print
a.rollback()
print a
Output of the example:
The Title of the Article
Article.title=My title
Article.page.1.Page.text=page 1
Article.page.2.Page.text=page 2
Article.title=My bad title
Article.page.1.Page.text=page 1
Article.page.2.Page.text=bad page 2
Article.page.3.Page.text=bad page 3
Article.title=My bad title
Article.page.1.Page.text=page 1
Article.page.2.Page.text=page 2
Article.title=My title
Article.page.1.Page.text=page 1
Article.page.2.Page.text=page 2
iÿÿÿÿNi ( t Transactiont Transactionlistc sC ‡ f d † } ˆ i | _ ˆ i | _ ˆ i | _ ˆ i | _ | S( s6 basic idea stolen from zope.interface.advice, P.J. Ebyc s‰ t i d ƒ } d | i j oY d | i i j oF d | i j o t d ƒ ‚ n ‡ ‡ ‡ f d † } | | i d <n ˆ ˆ ˆ Ž d S( Ni t
__module__t
__metaclass__sZ Don't use two class initializers or
a class initializer together with a __metaclass__ hookc su y t | | | ƒ } WnH t j
o<