Archetype destructor
Hi I try to control how an archetype object instance is deleted but I can't find the destructor Can anyone point me about these? Thanks!!!!
On Mon, Mar 14, 2005 at 01:51:08PM +0100, Garito wrote:
Hi I try to control how an archetype object instance is deleted but I can't find the destructor
Can anyone point me about these?
You might do better on one of these mailing lists: http://plone.org/contact/ ... probably this one: http://lists.sourceforge.net/lists/listinfo/archetypes-users -- Paul Winkler http://www.slinkp.com
Garito wrote at 2005-3-14 13:51 +0100:
I try to control how an archetype object instance is deleted but I can't find the destructor
You use "manage_beforeDelete" for this. Note, however, that "manage_beforeDelete" is used also for moving. In this case, a "manage_afterAdd" will later follow (at the new place). -- Dieter
Dieter Maurer escribió:
Garito wrote at 2005-3-14 13:51 +0100:
I try to control how an archetype object instance is deleted but I can't find the destructor
You use "manage_beforeDelete" for this.
Note, however, that "manage_beforeDelete" is used also for moving. In this case, a "manage_afterAdd" will later follow (at the new place).
Hi Dieter, Thanks for your help In the same way I try to control the edition process Can you point me how I could override the update() process? I want to annotate some data before edition complete but I like the regular process of update the information. For that I would like to create the tipical: def update(self, < I don't know the firm>): <Base class>.update(<parameters>) <Make my annotation> I don't remember the name of these (much more beer, jeje) Thanks again!
Garito wrote at 2005-3-17 00:40 +0100:
... In the same way I try to control the edition process Can you point me how I could override the update() process?
I never heard of an "update process"... What do you mean with that?
I want to annotate some data before edition complete but I like the regular process of update the information. For that I would like to create the tipical:
def update(self, < I don't know the firm>): <Base class>.update(<parameters>) <Make my annotation>
I don't remember the name of these (much more beer, jeje)
Maybe, you search the source? If the only thing you do not know are the parameters (and you do not call the methods through the Web), you can use def update(self, *args, **kw): <Base class>.update(self, *args, **kw) ... -- Dieter
Dieter Maurer escribió:
Garito wrote at 2005-3-17 00:40 +0100:
... In the same way I try to control the edition process Can you point me how I could override the update() process?
I never heard of an "update process"... What do you mean with that?
I want to annotate some data before edition complete but I like the regular process of update the information. For that I would like to create the tipical:
def update(self, < I don't know the firm>): <Base class>.update(<parameters>) <Make my annotation>
I don't remember the name of these (much more beer, jeje)
Maybe, you search the source?
If the only thing you do not know are the parameters (and you do not call the methods through the Web), you can use
def update(self, *args, **kw): <Base class>.update(self, *args, **kw) ...
Forget it Dieter I solve the question creating a new workflow. The feature requieres not to annotate the edition. In fact requieres to annotate when the reviewer put the object in publish state Thanks for your time and help and sorry for my english
Garito ha scritto:
Dieter Maurer escribió:
Garito wrote at 2005-3-17 00:40 +0100:
... In the same way I try to control the edition process Can you point me how I could override the update() process?
I never heard of an "update process"... What do you mean with that?
I want to annotate some data before edition complete but I like the regular process of update the information. For that I would like to create the tipical:
def update(self, < I don't know the firm>): <Base class>.update(<parameters>) <Make my annotation>
I don't remember the name of these (much more beer, jeje)
Maybe, you search the source?
If the only thing you do not know are the parameters (and you do not call the methods through the Web), you can use
def update(self, *args, **kw): <Base class>.update(self, *args, **kw) ...
Forget it Dieter I solve the question creating a new workflow. The feature requieres not to annotate the edition. In fact requieres to annotate when the reviewer put the object in publish state
Thanks for your time and help and sorry for my english
_______________________________________________ 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 )
Hi all, I have a PythonScript like this, to list the village names in serbian language, and it works.... data=request.SESSION.get('data') items=len(data[0]['head']) for j in range(items): # print container.mescat('city: ') + data[0]['head'][j][5] print data[0]['head'][j][5] return printed result: Priština Beleg ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If I change the script like this one, it doesn't work anymore: data=request.SESSION.get('data') items=len(data[0]['head']) for j in range(items): print container.mescat('city: ') + data[0]['head'][j][5] # print data[0]['head'][j][5] return printed It should print this result: sela: Priština sela: Beleg but I have instead the following error: *Error Type: UnicodeDecodeError* *Error Value: 'ascii' codec can't decode byte 0xc5 in position 5: ordinal not in range(128) * Any help would be appreciated. Jo
I'm not familiar with the function mescat, but have you tried: data=request.SESSION.get('data') items=len(data[0]['head']) for j in range(items): print container.mescat(u'city: ') + data[0]['head'][j][5] return printed It might prefer the input string to be unicode. Gre7g
jose wrote at 2005-3-18 11:44 +0100:
... I have a PythonScript like this, to list the village names in serbian language, and it works.... ... # print container.mescat('city: ') + data[0]['head'][j][5] ... If I change the script like this one, it doesn't work anymore: ... print container.mescat('city: ') + data[0]['head'][j][5] ... but I have instead the following error:
*Error Type: UnicodeDecodeError* *Error Value: 'ascii' codec can't decode byte 0xc5 in position 5: ordinal not in range(128)
Apparently "mescat('city: ')" returns unicode. This forces all strings combined with it to be converted to unicode. Python uses its "defaultencoding" for this conversion (default: "ascii"). Because your "data[0]..." contains serbian characters, they cannot be decoded using "ascii". Your options: * use the "unicode" function to convert "data[0]..." to unicode. You must provide the correct encoding as second argument (otherwise, you get the same error). * change Python's "defaultencoding" with "sys.setdefaultencoding(the_encoding)". This is only possible at startup (usually done in "sitecustomize.py". Unicode fanatics do not like this solution... -- Dieter
Dieter Maurer ha scritto:
jose wrote at 2005-3-18 11:44 +0100:
... I have a PythonScript like this, to list the village names in serbian language, and it works.... ... # print container.mescat('city: ') + data[0]['head'][j][5] ... If I change the script like this one, it doesn't work anymore: ... print container.mescat('city: ') + data[0]['head'][j][5] ... but I have instead the following error:
*Error Type: UnicodeDecodeError* *Error Value: 'ascii' codec can't decode byte 0xc5 in position 5: ordinal not in range(128)
Apparently "mescat('city: ')" returns unicode. This forces all strings combined with it to be converted to unicode. Python uses its "defaultencoding" for this conversion (default: "ascii").
Because your "data[0]..." contains serbian characters, they cannot be decoded using "ascii".
Your options:
* use the "unicode" function to convert "data[0]..." to unicode.
You must provide the correct encoding as second argument (otherwise, you get the same error).
* change Python's "defaultencoding" with "sys.setdefaultencoding(the_encoding)".
This is only possible at startup (usually done in "sitecustomize.py".
Unicode fanatics do not like this solution...
I would like to follow your tip by changing sitecustomize.py but I am fear that a such global configuration maybe will change some unwanted behavior in other Zope modules. Could you ensure me there are no collateral effect with other modules? jo
jose wrote at 2005-3-21 17:01 +0100:
...
Your options:
* use the "unicode" function to convert "data[0]..." to unicode.
You must provide the correct encoding as second argument (otherwise, you get the same error).
* change Python's "defaultencoding" with "sys.setdefaultencoding(the_encoding)".
This is only possible at startup (usually done in "sitecustomize.py".
Unicode fanatics do not like this solution...
I would like to follow your tip by changing sitecustomize.py but I am fear that a such global configuration maybe will change some unwanted behavior in other Zope modules. Could you ensure me there are no collateral effect with other modules?
I use a "sitecustomize" with "sys.setdefaultencoding('iso-8859-15')" since ages. Up to now, I met a single problem: It triggered a bug in Python's "xmlrpclib". "xmlrpmlic" wrongfully assumes that "str(unicode)" either converts to 7 bit ascii or raises an exception. This is only true for 'ascii' as default encoding. This bug will be fixed in Python 2.4.1. Thus, I can tell you for sure: there is buggy software around that gets confused if "defaultencoding" is not "ascii". -- Dieter
Dieter Maurer wrote:
jose wrote at 2005-3-21 17:01 +0100:
...
Your options:
* use the "unicode" function to convert "data[0]..." to unicode.
You must provide the correct encoding as second argument (otherwise, you get the same error).
* change Python's "defaultencoding" with "sys.setdefaultencoding(the_encoding)".
This is only possible at startup (usually done in "sitecustomize.py".
Unicode fanatics do not like this solution...
I would like to follow your tip by changing sitecustomize.py but I am fear that a such global configuration maybe will change some unwanted behavior in other Zope modules. Could you ensure me there are no collateral effect with other modules?
I use a "sitecustomize" with "sys.setdefaultencoding('iso-8859-15')" since ages.
Up to now, I met a single problem:
It triggered a bug in Python's "xmlrpclib". "xmlrpmlic" wrongfully assumes that "str(unicode)" either converts to 7 bit ascii or raises an exception. This is only true for 'ascii' as default encoding.
This bug will be fixed in Python 2.4.1.
Thus, I can tell you for sure: there is buggy software around that gets confused if "defaultencoding" is not "ascii".
Ok Dieter, with the personalization you counseil to me, now it works fine, thank you very much for your precious help. jo
participants (5)
-
Dieter Maurer -
Garito -
Gre7g Luterman -
jose -
Paul Winkler