Loading

Paste #pv6sresix

  1. diff -r 62877abb8ef0 webtranslate/users/redmine.py
  2. --- a/webtranslate/users/redmine.py Fri Dec 23 14:39:42 2016 +0100
  3. +++ b/webtranslate/users/redmine.py Mon Jan 08 19:08:25 2018 +0100
  4. @@ -118,20 +118,21 @@
  5.  
  6.      @param parms: Parameters of the command.
  7.      @type  parms: C{tuple} of C{str}
  8.  
  9.      @return: Cursor with the result, if all went well, else C{None}
  10.      @rtype:  db cursor, or C{None}
  11.      """
  12.      global db_type, db_schema, db_name, db_password, db_user, db_host, db_port, db_connection
  13.  
  14.      if db_type == 'postgress':
  15. +        import psycopg2
  16.          cur = db_connection.cursor()
  17.          try:
  18.              cur.execute(cmd, parms)
  19.              return cur
  20.          except psycopg2.OperationalError:
  21.              # Administrator closed the connection.
  22.              db_connection = None
  23.              return None
  24.  
  25.      else:
  26.  

Comments