Re: [Zope-dev] Redirecting from the manage interfaces.

2000-07-21 Thread Dieter Maurer

Erik Enge wrote:
  call, it won't redirect.  So you should be able to achieve the same
  results just by invoking manage_addImage without including the REQUEST
  object.
 
 But I have to pass something with the REQUEST, or else it won't add the
 image, right?
I do not think so.

"manage_addImage" does not need REQUEST to add the image.
The request is only used to redirect.


Dieter

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




Re: [Zope-dev] Redirecting from the manage interfaces.

2000-07-20 Thread Chris Withers

Erik Enge wrote:
 
 On Wed, 19 Jul 2000, Chris Withers wrote:
 
  Why I'm asking is 'cos it'd be really nice not to have to keep
  re-writing UI when there's perfectly good stuff available in the
  management interface, things like add forms, edit forms, etc...
 
 Exactly.

Great, so how do we solve this. The 'wrapping REQUEST adn RESPONSE'
thing seesm a little hacky to me, if this isn't the case then could
someone show us some code as to how to do it in a specific instance?

If it is hacky, then how can we solve this long term? fishbowl time?

cheers,

Chris

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




Re: [Zope-dev] Redirecting from the manage interfaces.

2000-07-19 Thread Chris Withers

Erik Enge wrote:
  call, it won't redirect.  So you should be able to achieve the same
  results just by invoking manage_addImage without including the REQUEST
  object.
 
 But I have to pass something with the REQUEST, or else it won't add the
 image, right?

This is the problem we've experienced here at NIP...

  A convention I've seen that works just a little better is to redirect
  based on the existence of a RESPONSE object.  You need RESPONSE to
  redirect, so if it isn't provided, you shouldn't redirect.
 
  Of course this needs to be documented and more reliable.

Hmm, I wonder if you could specify in the RESPONSE object where the
redirection would take place to?

Why I'm asking is 'cos it'd be really nice not to have to keep
re-writing UI when there's perfectly good stuff available in the
management interface, things like add forms, edit forms, etc...

However, if you call these from anywhere else, they dump you in the
management interface when you're finished rather than going to where you
want them to.

Any ideas or am I missing the point?

cheers,

Chris

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




Re: [Zope-dev] Redirecting from the manage interfaces.

2000-07-19 Thread Steve Alexander

Chris Withers wrote:
 
 Why I'm asking is 'cos it'd be really nice not to have to keep
 re-writing UI when there's perfectly good stuff available in the
 management interface, things like add forms, edit forms, etc...
 
 However, if you call these from anywhere else, they dump you in the
 management interface when you're finished rather than going to where you
 want them to.
 
 Any ideas or am I missing the point?

Silly idea: Write a wrapper that you put around the RESPONSE object that
does its own thing when it is told to redirect. You might have to wrap
the REQUEST object too, so that it returns a wrapped RESPONSE object.

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net

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




[Zope-dev] Redirecting from the manage interfaces.

2000-07-15 Thread Erik Enge


Hi.

I've been browsing through the Zope and Zope-dev archives without finding
anything related to this, please stop me if it has already been dealt
with. :)

technical person = someone who doesn't mind fuzzing around with the
   manage_main pages

non-technical person = someone who needs everything in bright nice colors
   and would start crying if they saw the manage_main
   page, or anything similar.

I have a Product that allows a customer of mine to add some nice pictures
(Image object) to a folder.  The add-method is nice and doesn't display
any horrible technical information.  I wasn't very keen on making a 
add-method for both the technical person and the non-technical person, so
I hacked the source code a bit.  I changed the the lib/python/OFS/Image.py

It used to look like this:

"""
def manage_addImage(self, id, file, title='', precondition='', 
content_type='', REQUEST=None):

[...]
if REQUEST is not None:
try:url=self.DestinationURL()
except: url=REQUEST['URL1']
REQUEST.RESPONSE.redirect('%s/manage_main' % url)
return id
"""

Which I changed into:

"""
def manage_addImage(self, id, file, title='', precondition='', 
content_type='', REQUEST=None, redir=None):

[...]
if redir is not None:
REQUEST.RESPONSE.redirect('%s' % redir)
elif REQUEST is not None:
try:url=self.DestinationURL()
except: url=REQUEST['URL1']
REQUEST.RESPONSE.redirect('%s/manage_main' % url)
"""

Now I can redirect the victim... erm.. customer to the method I want to,
and they are pleased that they don't have to see the management interface.

This saves me a lot of time, since I don't have to make several
add-methods, and maintainace is a more joyable happening. :)

This 'redir' thing is something I've stuck into a lot of .py files
(for example, I use it in the manage_delObjects and others).  And
it is something I do every time a new Zope release comes out.  Could this
be to any use for anybody besides me?  And if it could, how about adding
it to the next release?


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




Re: [Zope-dev] Redirecting from the manage interfaces.

2000-07-15 Thread Erik Enge

On Sat, 15 Jul 2000, Shane Hathaway wrote:

 call, it won't redirect.  So you should be able to achieve the same
 results just by invoking manage_addImage without including the REQUEST
 object.

But I have to pass something with the REQUEST, or else it won't add the
image, right?
 
 A convention I've seen that works just a little better is to redirect
 based on the existence of a RESPONSE object.  You need RESPONSE to
 redirect, so if it isn't provided, you shouldn't redirect.
 
 Of course this needs to be documented and more reliable.

Ahh. :)  Is this work-in-progress by someone?


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