forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd274105
committed
> There is an ugly little problem with the DB wrapper class.
>> In pg.py the attributes of DB are defined as being the same as> the attributes of the corresponding pgobject "db", using the following...> The problem is that the attributes of db (which are read only)> are not static (they are actually function calls to PostgreSQL),> especially "status" and "error", but those attributes are copied> and this is done only once when initializing the DB object.>> So, in effect, only the attribute "db.error" of a DB instance> will be updated, but not the attribute "error". Same with "status".> Don't copy the (read only) attributes of the pgobject to the> DB object, but only the methods, and all of them, like this:>> --------------- change in pg.py ------------------> # Create convience methods, in a way that is still overridable.> for e in self.db.__methods__:> setattr(self, e, getattr(self.db, e))> ---------------------------------------------------->> Furthermore, make an addition to the documentation of the> DB wrapper class (i.e. in pygresql-pg-db.html):> After the sentence "All pgobject methods are included in this class also."> add the following sentence "The pgobject read-only attributes can be> accessed py adding the prefix 'db.' to them."Christoph Zwerschke1 parent482ed83 commitd274105
2 files changed
+16
-15
lines changedLines changed: 12 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 |
| - | |
| 1 | + | |
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
| |||
2413 | 2413 |
| |
2414 | 2414 |
| |
2415 | 2415 |
| |
2416 |
| - | |
2417 |
| - | |
2418 |
| - | |
2419 |
| - | |
2420 |
| - | |
2421 |
| - | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
2422 | 2427 |
| |
2423 | 2428 |
| |
2424 | 2429 |
| |
|
Lines changed: 4 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
48 | 48 |
| |
49 | 49 |
| |
50 | 50 |
| |
51 |
| - | |
52 |
| - | |
53 |
| - | |
54 |
| - | |
55 |
| - | |
56 |
| - | |
57 |
| - | |
58 |
| - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
59 | 55 |
| |
60 | 56 |
| |
61 | 57 |
| |
|
0 commit comments
Comments
(0)