Re: coding question

Gerhard Häring <[email protected]> Fri, 18 Aug 2006 23:55:33 +0200
Newsgroups gmane.comp.python.db.pypgsql.user
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mignon Laurent wrote:
> Hy,
> 
> In your python abstraction layer (pgsql.py) you directly access the
> __dict__ .  If I understand the code, you use this mechanism in
> conjunction of the overriding of __setattr__ to control the acces to
> some attributes that you want  readonly. 
> I can understand that that was in the past the only way to control
> access to some attributes. Today, python allow you to define property
> and to control access to a variable through getter and setter ...
> The fact that the code access direclyt to the __dict__ is a problem for
> me when I use this module in threads running in restricted mode (access
> is denied!).  Can I rewrite the code to use property and avoid the
> access to the __dict__. Do you think that it is a good thing?

You can of course rewrite the code yourself for your own uses. The reason
pyPgSQL uses tricks with __dict__ is that it was written with Python 2.1
compatibility in mind.

If the code was written today, it would of course be written using modern
Python features :-)

- -- Gerhard
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE5jdUdIO4ozGCH14RAnUvAKCOjGttmaZ0aR/R44VUCmt/iZvmDwCeO2vk
hnuM0hXIF+/72MLWdjUYuhE=
=LynY
-----END PGP SIGNATURE-----

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642