Commits

Anonymous committed b96c9c4

fix dates, null categories in qdbload

  • Participants
  • Parent commits 610e5d7

Comments (0)

Files changed (1)

 
 """
 
-from trxtsv import trxiter
+from trxtsv import trxiter, isoDate
 from trxht import trxdetails
 
 from UserDict import DictMixin
                   # django adds _id to ref fields
                   ('id', 'acct_id', 'date', 'payee', 'num', 'ty', 'memo'),
                   (tid, accounts[tx['acct']],
-                   tx['date'],
+                   isoDate(tx['date']),
                    tx.get('payee', None),
                    tx.get('num', None),
                    tx.get('ty', None),
 
             # combine categories and transfer accounts
             a2 = split.get('acct', split.get('cat'))
+            if a2: a2 = accounts[a2]
             if 'class' in split:
                 cls = classes[split['class']]
-                if split['class'] == 'A]':
-                    raise ValueError, trx
             else:
                 cls = None
             db.insert(splits,
                       ('id', 'trx_id', 'acct_id',
                        'job_id', 'clr', 'memo', 'subtot'),
                       (sid, tid,
-                       accounts[a2],
-                       cls,
+                       a2, cls,
                        split.get('clr', None),
                        split.get('memo', None),
                        split['subtot']))
         self._t = db.mktable(self._name)
 
     def __getitem__(self, k):
+        assert k is not None
         d = self._d
         try:
             return d[k]