[Zope-dev] property type

2003-02-06 Thread Tim McLaughlin
According to docs and testing (in the interpreter) I can make a 
read-only calculated attribute using property() (I know that setters do 
not work w/ non-new-style classes).  So I tried the following:

class CMixin:
  def getter(self):
return 'test'
  prop = property(getter)

and when I try to mix in this object w/ a Folder object, the instance 
returns property object at 0x8b45edc for the 'prop' attribute.  Is 
this an issue with pickling or something else?

Cheers,
Tim
--
Tim McLaughlin
Chief Technology Officer
Siteworx, Inc... Set your site on the future!
703.390.5421


msg12579/pgp0.pgp
Description: PGP signature


Re: [Zope-dev] property type

2003-02-06 Thread Steve Alexander
Tim McLaughlin wrote:

According to docs and testing (in the interpreter) I can make a 
read-only calculated attribute using property() (I know that setters do 
not work w/ non-new-style classes).  So I tried the following:

class CMixin:
  def getter(self):
return 'test'
  prop = property(getter)

and when I try to mix in this object w/ a Folder object, the instance 
returns property object at 0x8b45edc for the 'prop' attribute.  Is 
this an issue with pickling or something else?

In Zope 2, the ExtensionClass that is the C base class used for 
Persistent classes, doesn't work with python 2.2 properties.

--
Steve Alexander



___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] property type

2003-02-06 Thread Steve Alexander
Steve Alexander wrote:

Tim McLaughlin wrote:


According to docs and testing (in the interpreter) I can make a 
read-only calculated attribute using property() (I know that setters 
do not work w/ non-new-style classes).  So I tried the following:

class CMixin:
  def getter(self):
return 'test'
  prop = property(getter)

and when I try to mix in this object w/ a Folder object, the instance 
returns property object at 0x8b45edc for the 'prop' attribute.  Is 
this an issue with pickling or something else?


In Zope 2, the ExtensionClass that is the C base class used for 
Persistent classes, doesn't work with python 2.2 properties.

But, you can use a ComputedAttribute to get much the same effect.

--
Steve Alexander



___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )