Changes between Version 1 and Version 2 of TracSqlAlchemyBridgeIntegration


Ignore:
Timestamp:
Jul 13, 2008 12:21:03 AM (6 years ago)
Author:
s0undt3ch
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracSqlAlchemyBridgeIntegration

    v1 v2  
    1616 
    1717Download the zipped source from [download:tracsqlalchemybridgeintegration here]. 
     18 
     19Download from [http://pypi.python.org/ PyPi] from [http://pypi.python.org/pypi/TracSqlAlchemyBridge/ here]. 
    1820 
    1921== Source == 
     
    4446    def environment_needs_upgrade(self, db): 
    4547        cursor = db.cursor() 
    46         cursor.execute("SELECT value FROM system WHERE name=%s", 
     48        cursor.execute("SELECT value FROM system WHERE name=%s";, 
    4749                       (model.name,)) 
    4850        value = cursor.fetchone() 
     
    5254        else: 
    5355            self.found_db_version = int(value[0]) 
    54             self.log.debug("%s: Found db version %s, current is %s", 
     56            self.log.debug("%s: Found db version %s, current is %s", 
    5557                           __package__, self.found_db_version, model.version) 
    56             return self.found_db_version < model.version 
     58            return self.found_db_version < model.version 
    5759 
    5860    def upgrade_environment(self, db): 
     
    6163        cursor = db.cursor() 
    6264        if not self.found_db_version: 
    63             cursor.execute(&#34;INSERT INTO system (name, value) VALUES (%s, %s)&#34;, 
     65            cursor.execute("INSERT INTO system (name, value) VALUES (%s, %s)", 
    6466                           (model.name, model.version)) 
    6567        else: 
    66             cursor.execute(&#34;UPDATE system SET value=%s WHERE name=%s&#34;, 
     68            cursor.execute("UPDATE system SET value=%s WHERE name=%s", 
    6769                           (model.version, model.name)) 
    6870}}} 
    6971 
    70 Then to use it in your code((rom the plugin I was developing from which this package was born): 
     72Then to use it in your code(from the plugin I was developing from which this package was born): 
    7173{{{ 
    7274#!python 
    7375 
    74 #--------8&lt;------- code cut for readability --------8&lt;------- 
     76#--------8<------- code cut for readability --------8<------- 
    7577from tsab import session 
    76 #--------8&lt;------- code cut for readability --------8&lt;------- 
     78#--------8<------- code cut for readability --------8<------- 
    7779class L10nModule(Component): 
    78 #--------8&lt;------- code cut for readability --------8&lt;------- 
     80#--------8<------- code cut for readability --------8<------- 
    7981    def _list_messages(self, req, catalog_id, locale_name, page): 
    8082        Session = session(self.env) 
     
    105107                     _('Previous Page')) 
    106108        return 'l10n_messages.html', data, None 
    107 #--------8&lt;------- code cut for readability --------8&lt;------- 
     109#--------8<------- code cut for readability --------8<------- 
    108110}}} 
    109111 
     
    116118== Author/Contributors == 
    117119 
    118 '''Author:''' [wiki:s0undt3ch] [[BR]] 
     120'''Author:''' [wiki:mitsuhiko], [wiki:s0undt3ch] [[BR]] 
    119121'''Contributors:'''