More re: a startup puzzle

Edward K. Ream edreamleo at charter.net
Tue Oct 7 10:31:59 EDT 2003


A bug fix: the proxy class really should have a __setattr__ method.
Otherwise some attributes may end up being set in the proxy class rather
than the app class as expected, which will cause problems if there are any
direct references to the app object.

So the proxy class should be something like this:

class leoProxy:

  """A proxy for the gApp object that can be created before gApp itself.

  After gApp is created, both app.x and app().x refer to gApp.x."""

  def __getattr__(self,attr):
    return getattr(gApp,attr)

  def __setattr__(self,attr,val):
    setattr(gApp,attr,val)

  def __call__(self):
    return gApp

Edward
--------------------------------------------------------------------
Edward K. Ream   email:  edreamleo at charter.net
Leo: Literate Editor with Outlines
Leo: http://webpages.charter.net/edreamleo/front.html
--------------------------------------------------------------------






More information about the Python-list mailing list