diff options
author | Rob Austein <sra@hactrn.net> | 2007-09-07 09:05:07 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2007-09-07 09:05:07 +0000 |
commit | 4d586052503ffc5d047a6fed07ac03cf92ae11ab (patch) | |
tree | a1548a946d2b93593e8f0822fb904102d575b740 /scripts/rpki/sql.py | |
parent | dcb003ef33f8f2155f61b680bfeedbe5b0a211fe (diff) |
Checkpoint
svn path=/scripts/rpki/sql.py; revision=933
Diffstat (limited to 'scripts/rpki/sql.py')
-rw-r--r-- | scripts/rpki/sql.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/rpki/sql.py b/scripts/rpki/sql.py index 785caa38..9215abef 100644 --- a/scripts/rpki/sql.py +++ b/scripts/rpki/sql.py @@ -32,6 +32,10 @@ class sql_persistant(object): # to SQL. sql_dirty = False + ## @var sql_attributes + # Tuple of attributes to translate between this Python object and its SQL representation. + sql_attributes = None # Must be overriden by derived type + @classmethod def sql_fetch(cls, db, **kwargs): """Fetch rows from SQL based on a canned query and a set of @@ -89,3 +93,9 @@ class sql_persistant(object): for kids in self.sql_children.values(): for kid in getattr(self, kids): kid.sql_store(db, cur) + + def sql_makedict(self): + """Copy attributes from this object into a dict for use with + canned SQL queries. + """ + return dict((a, getattr(self, a)) for a in self.sql_attributes) |