Skip to content

Commit

Permalink
Moved Datum out to module scope
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdeboard committed Jul 23, 2011
1 parent 936ce5f commit a6194fa
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions python_usdol.py
Expand Up @@ -26,6 +26,18 @@
API_VER = 'V1'


class Datum:
created = datetime.datetime.now()
def __init__(self, d, ds, t):
self.dataset = ds
self.table = t
for key in d.keys():
setattr(self, key, d[key])

def __unicode__(self):
return self.dataset


class Connection(object):
'''
An instance of Connection represents a connection to the U.S. Dept.
Expand All @@ -47,18 +59,10 @@ class Connection(object):

def _datum_factory(self, dictionary, dataset, table):
'''
Class factory for individual result entries.
The Datum instance simply makes dictionary values available using
attribute syntax vice dictionary syntax.
'''
class Datum:
created = datetime.datetime.now()
def __init__(self, d, ds, t):
self.dataset = dataset
self.table = table
for key in d.keys():
setattr(self, key, d[key])
return Datum(dictionary, dataset, table)

def _urlencode(self, d):
Expand Down

0 comments on commit a6194fa

Please sign in to comment.