[Zope] custom_persist_obj

2005-06-20 Thread Tamas Hegedus

Hi,

I am new to Zope and not a programmer. It is a little bit complex for
me. I am very frustrated, as I can not find the solution for a pretty
simple task:

I would like to have persistent object with dictionaries.
I think I do not need a ZClass or Product, just a simple object for
holding mutable and persistent dictionaries (Manipulating with Script).
Like
MyObject:
  dict1 = [ a:1, b:1, c:1, ...]
  dict2 = [ a:2, d:4, e:6]
  etc.

Thanks for your help in advance,
Tamas
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] custom_persist_obj

2005-06-20 Thread Paul Winkler
On Mon, Jun 20, 2005 at 05:12:29AM -0400, Tamas Hegedus wrote:
 Hi,
 
 I am new to Zope and not a programmer. It is a little bit complex for
 me. I am very frustrated, as I can not find the solution for a pretty
 simple task:
 
 I would like to have persistent object with dictionaries.
 I think I do not need a ZClass or Product, just a simple object for
 holding mutable and persistent dictionaries (Manipulating with Script).
 Like
 MyObject:
   dict1 = [ a:1, b:1, c:1, ...]
   dict2 = [ a:2, d:4, e:6]
   etc.
 
 Thanks for your help in advance,
 Tamas

If you want a custom persistent object, you do indeed
need to write a Product.

But that needn't be complex.
http://www.zope.org/Members/maxm/HowTo/minimal_01


-- 

Paul Winkler
http://www.slinkp.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


RE: [Zope] custom_persist_obj

2005-06-20 Thread Pascal Peregrina
You have a built-in Zope object for this : PersistentMapping.

dict1=PersistentMapping({'a':1,'b':1,'c':1, ...})
dict1=PersistentMapping({'a':2,'d':4,'e':6})

The only thing you can not do compared to dictionaries is :
for key in dict1:
 do something
(you need to use for key in dict1.keys():...)

Pascal

-Message d'origine-
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] la part de
Tamas Hegedus
Envoyé : lundi 20 juin 2005 11:12
À : zope@zope.org
Objet : [Zope] custom_persist_obj


Hi,

I am new to Zope and not a programmer. It is a little bit complex for
me. I am very frustrated, as I can not find the solution for a pretty
simple task:

I would like to have persistent object with dictionaries.
I think I do not need a ZClass or Product, just a simple object for
holding mutable and persistent dictionaries (Manipulating with Script).
Like
MyObject:
   dict1 = [ a:1, b:1, c:1, ...]
   dict2 = [ a:2, d:4, e:6]
   etc.

Thanks for your help in advance,
Tamas
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**

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


Re: [Zope] custom_persist_obj

2005-06-20 Thread Paul Winkler
Well, sure. But you need to write some unrestricted (i.e.
filesystem-based) code if you want to create instanced of
PersistentMapping and the like.

by the way, if it's ever going to get large, you might look
into using OOBTree instead of PersistentMapping.
See:
http://www.zope.org/Wikis/ZODB/guide/node6.html#SECTION00063

-PW

On Mon, Jun 20, 2005 at 03:24:12PM +0200, Pascal Peregrina wrote:
 You have a built-in Zope object for this : PersistentMapping.
 
 dict1=PersistentMapping({'a':1,'b':1,'c':1, ...})
 dict1=PersistentMapping({'a':2,'d':4,'e':6})
 
 The only thing you can not do compared to dictionaries is :
 for key in dict1:
  do something
 (you need to use for key in dict1.keys():...)
 
 Pascal
 
 -Message d'origine-
 De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] la part de
 Tamas Hegedus
 Envoy? : lundi 20 juin 2005 11:12
 ? : zope@zope.org
 Objet : [Zope] custom_persist_obj
 
 
 Hi,
 
 I am new to Zope and not a programmer. It is a little bit complex for
 me. I am very frustrated, as I can not find the solution for a pretty
 simple task:
 
 I would like to have persistent object with dictionaries.
 I think I do not need a ZClass or Product, just a simple object for
 holding mutable and persistent dictionaries (Manipulating with Script).
 Like
 MyObject:
dict1 = [ a:1, b:1, c:1, ...]
dict2 = [ a:2, d:4, e:6]
etc.
 
 Thanks for your help in advance,
 Tamas
 ___
 Zope maillist  -  Zope@zope.org
 http://mail.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists - 
  http://mail.zope.org/mailman/listinfo/zope-announce
  http://mail.zope.org/mailman/listinfo/zope-dev )
 
 
 **
 This email and any files transmitted with it are confidential and
 intended solely for the use of the individual or entity to whom they
 are addressed. If you have received this email in error please notify
 the system manager.
 
 This footnote also confirms that this email message has been swept by
 MIMEsweeper for the presence of computer viruses.
 
 www.mimesweeper.com
 **
 
 ___
 Zope maillist  -  Zope@zope.org
 http://mail.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists - 
  http://mail.zope.org/mailman/listinfo/zope-announce
  http://mail.zope.org/mailman/listinfo/zope-dev )

-- 

Paul Winkler
http://www.slinkp.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )