Audit database addition insert 1

This commit is contained in:
Tim Bentley 2009-09-23 17:33:30 +01:00
parent 0ec1362424
commit 51fb1533bd
3 changed files with 16 additions and 12 deletions

View File

@ -22,13 +22,15 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
from datetime import date
from time import time
import logging import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from datetime import date
from openlp.core.lib import Plugin, Receiver, translate, str_to_bool from openlp.core.lib import Plugin, Receiver, translate, str_to_bool
from openlp.plugins.audit.lib import AuditTab, AuditManager from openlp.plugins.audit.lib import AuditTab, AuditManager
from openlp.plugins.audit.lib.models import AuditItem
class AuditPlugin(Plugin): class AuditPlugin(Plugin):
global log global log
@ -111,17 +113,22 @@ class AuditPlugin(Plugin):
Audit a live song from SlideController Audit a live song from SlideController
""" """
if self.auditActive: if self.auditActive:
audititem = AuditItem()
audititem.auditdate = date.today()
a = time.time()
audititem.audittime = time.time()
audititem.title = auditData[0]
audititem.ccl_id = auditData[2]
audititem.authors = u''
for author in auditData[1]: for author in auditData[1]:
self.auditFile.write(u'\"%s\",\"%s\",\"%s\",\"%s\"\n' % \ audititem.authors = author + u' '
(date.today(), auditData[0], author, auditData[2])) self.auditmanager.insert_audit(audititem)
self.auditFile.flush()
def onUpdateAudit(self): def onUpdateAudit(self):
""" """
Someone may have changed to audit details Someone may have changed to audit details
Sort out the file and the auditing state Sort out the file and the auditing state
""" """
self.auditFileNameNew = self.config.get_config(u'audit file', u'')
self.auditActive = str_to_bool( self.auditActive = str_to_bool(
self.config.get_config(u'audit active', False)) self.config.get_config(u'audit active', False))
if self.auditFileNameNew == u'': if self.auditFileNameNew == u'':

View File

@ -21,9 +21,6 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import sys
try: from audittab import AuditTab
from audittab import AuditTab from manager import AuditManager
from manager import AuditManager
except:
print sys.exc_info()

View File

@ -32,6 +32,6 @@ audit_table = Table(u'audit_data', metadata,
Column(u'auditdate', types.Date, index=True, nullable=False), Column(u'auditdate', types.Date, index=True, nullable=False),
Column(u'audittime', types.Time, index=True, nullable=False), Column(u'audittime', types.Time, index=True, nullable=False),
Column(u'title', types.Unicode(255), nullable=False), Column(u'title', types.Unicode(255), nullable=False),
Column(u'authors', types.UnicodeText, nullable=False), Column(u'authors', types.Unicode(255), nullable=False),
Column(u'ccl_id', types.Unicode(65), nullable=False) Column(u'ccl_id', types.Unicode(65), nullable=False)
) )