-################################################################################
-
-def get_or_set_contents_file_id(file):
- global content_file_id_cache
-
- if not content_file_id_cache.has_key(file):
- sql_select = "SELECT id FROM content_file_names WHERE file = '%s'" % file
- q = projectB.query(sql_select)
- if not q.getresult():
- # since this can be called within a transaction, we can't use currval
- q = projectB.query("INSERT INTO content_file_names VALUES (DEFAULT, '%s') RETURNING id" % (file))
- content_file_id_cache[file] = int(q.getresult()[0][0])
- return content_file_id_cache[file]