Changeset 460 for trunk/module/pg.py


Ignore:
Timestamp:
Nov 1, 2012, 7:18:23 AM (7 years ago)
Author:
cito
Message:

Allow setting the debug attribute just to True.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/module/pg.py

    r459 r460  
    157157        if not db or not hasattr(db, 'db') or not hasattr(db, 'query'):
    158158            db = connect(*args, **kw)
    159             self._closeable = 1
    160         else:
    161             self._closeable = 0
     159            self._closeable = True
     160        else:
     161            self._closeable = False
    162162        self.db = db
    163163        self.dbname = db.db
     
    169169        self.debug = None  # For debugging scripts, this can be set
    170170            # * to a string format specification (e.g. in CGI set to "%s<BR>"),
    171             # * to a file object to write debug statements or
    172             # * to a callable object which takes a string argument.
     171            # * to a file object to write debug statements,
     172            # * to a callable object which takes a string argument or
     173            # * to any other true value to just print debug statements.
    173174
    174175    def __getattr__(self, name):
     
    190191            elif callable(self.debug):
    191192                self.debug(s)
     193            else:
     194                print s
    192195
    193196    def _quote_text(self, d):
Note: See TracChangeset for help on using the changeset viewer.