[Zope] inheritance and aqusition question

Andrew Milton akm at theinternet.com.au
Fri Feb 3 08:22:49 EST 2006


+-------[ Roman Klesel ]----------------------
| Hello Andrew,
| 
| thanks for your reply.
| 
| Andrew Milton schrieb:
| > 
| > One (or more) of the following two;
| > 
| > Your class isn't yet fully instantiated and Acquisition wrapped, this normally
| > doesn't occur until your class is inside the ZODB. 
| 
| That's true! And it's nor supposed to be. It's only a temporary Object that's being destroyed
| after the method in which it's created has finished processing.

[snip]

| Probably I just do things in the wrong way. What I wnat to do is:
| 
| In the temporary object:
| 
| try:
|    h=open('file',r)
| except:
|    em = 'File %s does not exist' % file
|    return REQUEST.RESPONSE.redirect(self.manage_editSettings(REQUEST), em)

redirect should take a URL (i.e. a string), not a rendered page...

| the calling Object then would pass it to the browser ...
| 
| ... in order to do some exception handling.
| 
| is there an other way to redirect to the settigs Form when an error occurs in this nonpersistent object?

Since your class is already assuming things (manage_editSettings e.g.), 

a) pass in a parent object that is wrapped and call parentObj.manage_editSettings.. 
b) or more cleanly call parentObj.errorOccurred(message) which would do the redirect, 
c) or even more cleanly you could raise an exception, and catch it in the parent class, then redirect.

-- 
Andrew Milton
akm at theinternet.com.au


More information about the Zope mailing list