[Zope] delete from REQUEST?

Daryl Tester dt@picknowl.com.au
Wed, 22 Mar 2000 08:15:52 +1030


Ragnar Beer wrote:

> I need to get rid (completely) of some items in REQUEST that were
> passed from a form. Is there an opposite to REQUEST.set() that
> deletes instead e.g. REQUEST.delete() or so?

My Very First External Method (TM) -

def removeRequest(REQUEST, item):
    "Remove an item from a REQUEST.form"
    try:
        del REQUEST.form[item]
    except:
        pass
    return None

And invoked (once instantiated by the Management Interface) with

<dtml-call "removeRequest(REQUEST, 'form_variable')">

(Note that the except clause should really be trapping for KeyError -
version 1.1 will definitely have this :-).

Regards,
  Daryl Tester