+def get_or_set_maintainer_id (maintainer):
+ global maintainer_id_cache
+
+ if maintainer_id_cache.has_key(maintainer):
+ return maintainer_id_cache[maintainer]
+
+ if isinstance(maintainer, basestring):
+ if not isinstance(maintainer, unicode):
+ try:
+ maintainer = unicode(maintainer, 'utf-8')
+ except:
+ maintainer = unicode(maintainer, 'iso8859-15')
+ maintainer = maintainer.encode('utf-8')
+
+ print "%s" % maintainer
+ cursor = projectBdb.cursor()
+ cursor.execute("SELECT id FROM maintainer WHERE name=%s", (maintainer, ))
+ row = cursor.fetchone()
+ if not row:
+ cursor.execute("INSERT INTO maintainer (name) VALUES (%s)" , (maintainer, ))
+ cursor.execute("SELECT id FROM maintainer WHERE name=%s", (maintainer, ))
+ row = cursor.fetchone()
+ maintainer_id = row[0]
+ maintainer_id_cache[maintainer] = maintainer_id
+ cursor.close()
+
+ return maintainer_id
+
+
+def __get_changedby__(package, version):
+ cur = sqliteConn.cursor()
+ cur.execute("SELECT changedby FROM uploads WHERE package=? AND version=? LIMIT 1", (package, version))
+ res = cur.fetchone()
+ cur.close()
+ return res
+