Commits

Sam Hart committed 47a7657

fix various sundry typos and mistakes

Comments (0)

Files changed (4)

src/noink/entryDB.py

 from types import IntType, StringType
 
 from noink import mainDB
-from noink.urlDB import UrlDB
 from noink.dataModels import Entry
 from noink.pickler import PEntry, pickle, depickle
 from noink.eventLog import EventLog
 
         if not self._setup:
             self.eventLog = EventLog()
+            self._setup = True
+            from noink.urlDB import UrlDB
             self.urlDB = UrlDB()
-            self._setup = True
 
     def add(self, title, entry, author, url=None):
         '''
         now = datetime.datetime.now()
 
         e = Entry(title, author, now, entry)
+        u = None
 
-       if type(url) is StringType:
+        if type(url) is StringType:
             if self.urlDB.findByName(url):
                 raise DuplicateURL('The URL "%s" was already found in the UrlDB!' % url)
             else:
                 mainDB.session.add(e)
                 mainDB.session.commit()
-                self.urlDB.add(url, e)
+                u = self.urlDB.add(url, e)
         else:
             mainDB.session.add(e)
             mainDB.session.commit()
-        self.eventLog.add('add_entry', author.id, False, str(entry.id), entry.title)
+
+        pe = PEntry(e, u)
+        self.eventLog.add('add_entry', author.id, False, pickle(pe), entry.title)
         return e
 
     def findByTitle(self, title):

src/noink/pickler.py

         if url:
             self.url = copy(url.name)
 
-def pickle(self, obj):
+def pickle(obj):
     '''
     Takes an object to be pickled, will return the pickled string.
 
 
     @return String of pickled object.
     '''
-    return dumps(objs)
+    return dumps(obj)
 
-def depickle(self, string):
+def depickle(string):
     '''
     Takes a pickled string, and returns the de-pickled object.
 
 
     @return De-pickled object.
     '''
-    return loads(objs)
+    return loads(string)

src/noink/urlDB.py

 
 from noink import mainDB
 from noink.dataModels import URL
-from noink.entryDB import EntryDB
 from noink.eventLog import EventLog
 from noink.exceptions import EntryNotFound
 
 
         if not self._setup:
             self.eventLog = EventLog()
+            self._setup = True
+            from noink.entryDB import EntryDB
             self.entryDB = EntryDB()
-            self._setup = True
 
     def add(self, name, entry):
         '''

src/noink/userDB.py

         if type(u) is IntType:
             user = User.query.filter_by(id=u).first()
         uid = int(user.id)
-        uname = str(uder.name)
+        uname = str(user.name)
         mainDB.session.delete(user)
         mainDB.session.commit()
         self.eventLog.add('del_user', uid, True, None, uname)