search for id in database
authorSandro Knauß <knauss@netzguerilla.net>
Thu, 04 Nov 2010 22:47:00 +0100
changeset 60 5ca3aa8d75e1
parent 59 642098115855
child 61 04dfd43dfecc
child 68 85fc1e5dea79
search for id in database
iro/acounting.py
iro/joblist.py
iro/user.py
--- a/iro/acounting.py	Thu Nov 04 22:00:21 2010 +0100
+++ b/iro/acounting.py	Thu Nov 04 22:47:00 2010 +0100
@@ -1,6 +1,8 @@
 # -*- coding: utf-8 -*-
 
 from database import Database
+import logging
+logger=logging.getLogger("iro.acounting");
 
 class Acounting(Database):
     def __init__(self,id, connection):
--- a/iro/joblist.py	Thu Nov 04 22:00:21 2010 +0100
+++ b/iro/joblist.py	Thu Nov 04 22:47:00 2010 +0100
@@ -70,6 +70,10 @@
             m.update(str(time.time()))
             m.update(os.urandom(10))
             if not self.jobs.has_key(m.hexdigest):
-                self.jobs[m.hexdigest()]=None
-                break
+                if not self.dbconn:                    
+                    self.jobs[m.hexdigest()]=None
+                    break
+                if not self.manager.Acounting(m.hexdigest(),self.dbconn).getStatus():
+                    self.jobs[m.hexdigest()]=None
+                    break
         return m.hexdigest()
--- a/iro/user.py	Thu Nov 04 22:00:21 2010 +0100
+++ b/iro/user.py	Thu Nov 04 22:47:00 2010 +0100
@@ -98,11 +98,10 @@
         self.jobs[id]=self.jobqueue[id]
         return id
 
-    
-        
     def startMail(self, subject,  body, recipients, frm, provider="default"):
         if not "mail" in self.features:
             raise NotSupportedFeature("mail")
+        logger.debug("startMail(%s,%s,%s,%s,%s)"%(subject, body, recipients, frm, provider))
         id = self.jobqueue.newMail(subject, body, recipients, frm,  provider)
         self.jobs[id]=self.jobqueue[id]
         return id