From 1aef18807297ee8d27730c69d712738ad4e474e2 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Wed, 12 Aug 2009 20:43:10 +0000 Subject: [PATCH] undo last commit, some files are not ready --- sfa/plc/sfaImport.py | 2 +- sfa/util/genitable.py | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/sfa/plc/sfaImport.py b/sfa/plc/sfaImport.py index 4a321807..75292323 100644 --- a/sfa/plc/sfaImport.py +++ b/sfa/plc/sfaImport.py @@ -87,7 +87,7 @@ class sfaImport: AuthHierarchy = self.AuthHierarchy auth_info = AuthHierarchy.get_auth_info(auth_name) - table = GeniTable(cninfo=auth_info.get_dbinfo()) + table = GeniTable(hrn=auth_name, cninfo=auth_info.get_dbinfo()) # if the table doesn't exist, then it means we haven't put any records # into this authority yet. diff --git a/sfa/util/genitable.py b/sfa/util/genitable.py index 942848f4..2025fe9a 100644 --- a/sfa/util/genitable.py +++ b/sfa/util/genitable.py @@ -17,11 +17,14 @@ from sfa.util.debug import * class GeniTable: - GENI_TABLE_PREFIX = "sfa" + GENI_TABLE_PREFIX = "sfa$" - def __init__(self, create=False, cninfo=None): + def __init__(self, create=False, hrn="unspecified.default.registry", cninfo=None): - self.tablename = GeniTable.GENI_TABLE_PREFIX + self.hrn = hrn + + # pgsql doesn't like table names with "." in them, to replace it with "$" + self.tablename = GeniTable.GENI_TABLE_PREFIX + self.hrn.replace(".", "$") # establish a connection to the pgsql server self.cnx = DB(cninfo['dbname'], cninfo['address'], port=cninfo['port'], user=cninfo['user'], passwd=cninfo['password']) @@ -39,13 +42,9 @@ class GeniTable: return False def create(self): - seln't like table names with "." in them, to - - # pgsql doesn't like table names with "." in them, to.hrn = hrn querystr = "CREATE TABLE " + self.tablename + " ( \ key text, \ - authority text, \ hrn text, \ gid text, \ type text, \ @@ -54,7 +53,7 @@ class GeniTable: last_updated timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP);" template = "CREATE INDEX %s_%s_idx ON %s (%s);" indexes = [template % ( self.tablename, field, self.tablename, field) \ - for field in ['key', 'authority', 'hrn', 'type','pointer']] + for field in ['key', 'hrn', 'type','pointer']] # IF EXISTS doenst exist in postgres < 8.2 try: self.cnx.query('DROP TABLE IF EXISTS ' + self.tablename) -- 2.47.0