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 #
###############################################################################
from datetime import date
from time import time
import logging
from PyQt4 import QtCore, QtGui
from datetime import date
from openlp.core.lib import Plugin, Receiver, translate, str_to_bool
from openlp.plugins.audit.lib import AuditTab, AuditManager
from openlp.plugins.audit.lib.models import AuditItem
class AuditPlugin(Plugin):
global log
@ -111,17 +113,22 @@ class AuditPlugin(Plugin):
Audit a live song from SlideController
"""
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]:
self.auditFile.write(u'\"%s\",\"%s\",\"%s\",\"%s\"\n' % \
(date.today(), auditData[0], author, auditData[2]))
self.auditFile.flush()
audititem.authors = author + u' '
self.auditmanager.insert_audit(audititem)
def onUpdateAudit(self):
"""
Someone may have changed to audit details
Sort out the file and the auditing state
"""
self.auditFileNameNew = self.config.get_config(u'audit file', u'')
self.auditActive = str_to_bool(
self.config.get_config(u'audit active', False))
if self.auditFileNameNew == u'':

View File

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

View File

@ -32,6 +32,6 @@ audit_table = Table(u'audit_data', metadata,
Column(u'auditdate', types.Date, index=True, nullable=False),
Column(u'audittime', types.Time, index=True, 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)
)