Changeset 184

Show
Ignore:
Timestamp:
01/18/09 22:28:01 (10 months ago)
Author:
gallardj
Message:

Fixed a postgres quoting problem

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • management/bs-admin/trunk/cache_and_sync.py

    r183 r184  
    313313        value = cursor.fetchall() 
    314314        if value: 
    315           sql = "UPDATE elgg_profile_data SET value='%s' WHERE owner='%s' AND name='biography'" % (descr, project_id) 
    316           cursor.execute(sql
     315          sql = "UPDATE elgg_profile_data SET value=%s WHERE owner=%s AND name='biography'" 
     316          cursor.execute(sql, (descr, project_id)
    317317          conn.commit() 
    318318        else: 
    319           sql = "INSERT INTO elgg_profile_data VALUES (DEFAULT, '%s', 'LOGGED_IN', 'biography', '%s')" % (project_id, descr) 
    320           cursor.execute(sql
     319          sql = "INSERT INTO elgg_profile_data VALUES (DEFAULT, %s, 'LOGGED_IN', 'biography', %s)" 
     320          cursor.execute(sql, (project_id, descr)
    321321          conn.commit() 
    322322         
  • management/bs-admin/trunk/sync_elgg_trac.py

    r160 r184  
     1#!/usr/bin/python 
    12import psycopg2 
    23 
     
    5253  cursor.execute(sql) 
    5354  value = cursor.fetchall() 
    54   ownerid = value[0][0] 
     55  try: 
     56    ownerid = value[0][0] 
     57  except: 
     58    print value 
     59    print username 
     60    continue 
    5561  sql = "INSERT INTO elgg_users (username, name, active, owner, user_type, moderation) VALUES ('%s', '%s', 'yes', '%s', 'project', 'no');" % (shortname, project_name, ownerid) 
    5662  cursor.execute(sql)