You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by Martin Stoufer <MC...@lbl.gov> on 2006/12/07 22:43:54 UTC

Clarification on example provided

Graham,
    After pouring over the comments sent by you and Jim regarding my 
session/class examples, I have a better feel for what is expected in 
good coding models. Could you make some clarifications on one of the 
examples you provided:

class SessionEnabled:
    def __init__(self, target):
      self.__target = target
    def __call__(self):
      if not hasattr(req, 'session'):
         req.session = Session.Session(req)
      return util.apply_fs_data(self.__target, req.form)

  def _function(req, a, b):
    return a,b

  function = SessionEnabled(_function)

Was the 'req' arg left off the __call__ method by mistake?

I'm still a bit fuzzy about how the apply_fs_data() properly passes the 
req object down into the target function. My sandbox working example for 
this keeps complaining that no arguments are being provided to the function.

-- 
* Martin C. Stoufer              *
* DST/DIDC/ITG                   *
* Lawrence Berkeley National Lab *
* MS 50B-2239 510-486-8662       *