[Mpuls-commits] r1010 - in wasko/branches/2.0: . waskaweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jan 29 12:59:54 CET 2010


Author: bh
Date: 2010-01-29 12:59:52 +0100 (Fri, 29 Jan 2010)
New Revision: 1010

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/waskaweb/model/appointment.py
Log:
* waskaweb/model/appointment.py: Fix formatting.


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-01-29 11:13:54 UTC (rev 1009)
+++ wasko/branches/2.0/ChangeLog	2010-01-29 11:59:52 UTC (rev 1010)
@@ -1,5 +1,9 @@
 2010-01-29  Bernhard Herzog  <bh at intevation.de>
 
+	* waskaweb/model/appointment.py: Fix formatting.
+
+2010-01-29  Bernhard Herzog  <bh at intevation.de>
+
 	* waskaweb/model/case.py (ensure_unicode): New function to convert
 	objects to unicode.
 	(CaseFactory.loadById, CaseFactory.loadByName)

Modified: wasko/branches/2.0/waskaweb/model/appointment.py
===================================================================
--- wasko/branches/2.0/waskaweb/model/appointment.py	2010-01-29 11:13:54 UTC (rev 1009)
+++ wasko/branches/2.0/waskaweb/model/appointment.py	2010-01-29 11:59:52 UTC (rev 1010)
@@ -1,140 +1,150 @@
 # -*- coding: utf-8 -*-
 #
 # Copyright 2007, 2008 Intevation GmbH, Germany, <info at intevation.de>
-# 
-# This file is part of mpuls WASKA (CoMPUter-based case fiLeS - 
+#
+# This file is part of mpuls WASKA (CoMPUter-based case fiLeS -
 # Web-Anwendungs-Server fuer Kompetenzagenturen).
-# 
+#
 # mpuls WASKA is free software: you can redistribute it and/or modify it under
 # the terms of the GNU Affero General Public License as published by the
 # Free Software Foundation, either version 3 of the License, or (at your
 # option) any later version.
-# 
+#
 # mpuls WASKA is distributed in the hope that it will be useful, but WITHOUT
 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
 # License for more details.
-# 
+#
 # You should have received a copy of the GNU Affero General Public
 # License along with mpuls WASKA. If not, see <http://www.gnu.org/licenses/>.
-# 
-# mpuls WASKA has been developed on behalf of the 
+#
+# mpuls WASKA has been developed on behalf of the
 # Projekttraeger im Deutschen Zentrum fuer Luft- und Raumfahrt e.V. (PT-DLR)
 # within the programme Kompetenzagenturen (Durchfuehrungsphase) funded by
-# the Bundesministerium fuer Familie, Senioren, Frauen und Jugend and 
+# the Bundesministerium fuer Familie, Senioren, Frauen und Jugend and
 # European Social Fund resources.
 #
 # Authors:
 # Torsten Irländer <torsten.irlaender at intevation.de>
 #
-import psycopg2.extras
+
+import sys
 import os
 import traceback
-import sys
 from datetime import datetime, timedelta
 
+import psycopg2.extras
 
 import waskaweb.lib.helpers as h
-
 from waskaweb.lib.base import session
 from waskaweb.lib.db import db
 from waskaweb.model.agencysettings import Agency
-from waskaweb.model.case   import CaseOverview
-from waskaweb.model.user   import UserObject
+from waskaweb.model.case import CaseOverview
+from waskaweb.model.user import UserObject
 
-GET_GLOBAL_APPOINTMENT_SQL = "SELECT id, master_id, sdatum, edatum, name, beschreibung, art FROM ka_global_termine_tbl_view WHERE id = %(id)s"
-GET_GLOBAL_APPOINTMENTLIST_SQL = "SELECT id, master_id, sdatum, edatum, name, beschreibung, art FROM ka_global_termine_tbl_view WHERE coalesce(edatum, sdatum)::date+1 >= %(date)s::date ORDER BY sdatum"
-DELETE_GLOBAL_APPOINTMENT_SQL = "select delete_global_termin_ds(%(id)s)"
-CREATE_GLOBAL_APPOINTMENT_SQL = "select create_global_termin_ds()"
-STORE_GLOBAL_APPOINTMENT_SQL = "UPDATE ka_global_termine_tbl_view SET \
-                                sdatum = %(start_date)s::timestamp, \
-                                edatum = %(end_date)s::timestamp, \
-                                name = %(title)s, \
-                                beschreibung = %(description)s, \
-                                art = %(type)s \
-                                WHERE id = %(id)s"
 
-GET_CASE_APPOINTMENT_SQL = "SELECT id, master_id, sdatum, edatum, name, beschreibung, art FROM ka_fall_termine_tbl_view WHERE id = %(id)s"
-GET_CASE_APPOINTMENTLIST_SQL = "SELECT id, master_id, sdatum, edatum, name, beschreibung, art FROM ka_fall_termine_tbl_view WHERE master_id = %(id)s AND coalesce(edatum, sdatum)::date+1 >= %(date)s::date AND art = 0 ORDER BY sdatum"
-GET_CASE_REMINDERLIST_SQL = "SELECT id, master_id, sdatum, edatum, name, beschreibung, art FROM ka_fall_termine_tbl_view WHERE master_id = %(id)s AND art = 1 ORDER BY sdatum"
-GET_ALLCASES_APPOINTMENTLIST_SQL = "SELECT a.id, a.master_id, a.sdatum, a.edatum, a.name, a.beschreibung, a.art FROM ka_fall_termine_tbl_view a JOIN master_tbl_view m ON m.id = a.master_id WHERE coalesce(edatum, sdatum)::date+1 >= %(date)s::date AND art = 0 AND m.bearbeiter_id = %(editor)s ORDER BY sdatum"
-GET_ALLCASES_REMINDERLIST_SQL = "SELECT a.id, a.master_id, a.sdatum, a.edatum, a.name, a.beschreibung, a.art FROM ka_fall_termine_tbl_view a JOIN master_tbl_view m ON m.id = a.master_id WHERE art = 1 AND m.bearbeiter_id = %(editor)s ORDER BY sdatum"
-DELETE_CASE_APPOINTMENT_SQL = "select delete_fall_termin_ds(%(id)s)"
-CREATE_CASE_APPOINTMENT_SQL = "select create_fall_termin_ds(%(id)s)"
-STORE_CASE_APPOINTMENT_SQL = "UPDATE ka_fall_termine_tbl_view SET \
-                                sdatum = %(start_date)s::timestamp, \
-                                edatum = %(end_date)s::timestamp, \
-                                name = %(title)s, \
-                                beschreibung = %(description)s, \
-                                art = %(type)s \
-                                WHERE id = %(id)s"
+GET_GLOBAL_APPOINTMENT_SQL = """\
+SELECT id, master_id, sdatum, edatum, name, beschreibung, art
+FROM ka_global_termine_tbl_view
+WHERE id = %(id)s
+"""
+GET_GLOBAL_APPOINTMENTLIST_SQL = """\
+SELECT id, master_id, sdatum, edatum, name, beschreibung, art
+FROM ka_global_termine_tbl_view
+WHERE coalesce(edatum, sdatum)::date+1 >= %(date)s::date ORDER BY sdatum
+"""
+DELETE_GLOBAL_APPOINTMENT_SQL = "SELECT delete_global_termin_ds(%(id)s)"
+CREATE_GLOBAL_APPOINTMENT_SQL = "SELECT create_global_termin_ds()"
+STORE_GLOBAL_APPOINTMENT_SQL = """\
+UPDATE ka_global_termine_tbl_view
+SET
+    sdatum = %(start_date)s::timestamp,
+    edatum = %(end_date)s::timestamp,
+    name = %(title)s,
+    beschreibung = %(description)s,
+    art = %(type)s
+WHERE id = %(id)s
+"""
 
-#GET_OLDACTIVE_CASES = """SELECT m.id, s.zugriff, 
-#getLastCaseAppointment(m.id) as last_date 
-#from master_tbl_view m 
-#JOIN ka_status_tbl_view s 
-#ON s.master_id = m.id 
-#WHERE s.status <> 5 
-#AND extract(day from now()-getLastCaseAppointment(m.id)) > %(maxdays)s 
-#AND m.zeitraum_nachbetreuung = -1 
-#AND m.cm_end_art <> 1"""
+GET_CASE_APPOINTMENT_SQL = """\
+SELECT id, master_id, sdatum, edatum, name, beschreibung, art
+FROM ka_fall_termine_tbl_view
+WHERE id = %(id)s
+"""
+GET_CASE_APPOINTMENTLIST_SQL = """\
+SELECT id, master_id, sdatum, edatum, name, beschreibung, art
+FROM ka_fall_termine_tbl_view
+WHERE master_id = %(id)s
+      AND coalesce(edatum, sdatum)::date+1 >= %(date)s::date
+      AND art = 0
+ORDER BY sdatum
+"""
+GET_CASE_REMINDERLIST_SQL = """\
+SELECT id, master_id, sdatum, edatum, name, beschreibung, art
+FROM ka_fall_termine_tbl_view
+WHERE master_id = %(id)s AND art = 1
+ORDER BY sdatum
+"""
+GET_ALLCASES_APPOINTMENTLIST_SQL = """\
+SELECT a.id, a.master_id, a.sdatum, a.edatum, a.name, a.beschreibung, a.art
+FROM ka_fall_termine_tbl_view a JOIN master_tbl_view m ON m.id = a.master_id
+WHERE coalesce(edatum, sdatum)::date+1 >= %(date)s::date
+      AND art = 0 AND m.bearbeiter_id = %(editor)s
+ORDER BY sdatum
+"""
+GET_ALLCASES_REMINDERLIST_SQL = """\
+SELECT a.id, a.master_id, a.sdatum, a.edatum, a.name, a.beschreibung, a.art
+FROM ka_fall_termine_tbl_view a JOIN master_tbl_view m ON m.id = a.master_id
+WHERE art = 1 AND m.bearbeiter_id = %(editor)s
+ORDER BY sdatum
+"""
+DELETE_CASE_APPOINTMENT_SQL = "SELECT delete_fall_termin_ds(%(id)s)"
+CREATE_CASE_APPOINTMENT_SQL = "SELECT create_fall_termin_ds(%(id)s)"
+STORE_CASE_APPOINTMENT_SQL = """\
+UPDATE ka_fall_termine_tbl_view
+SET
+    sdatum = %(start_date)s::timestamp,
+    edatum = %(end_date)s::timestamp,
+    name = %(title)s,
+    beschreibung = %(description)s,
+    art = %(type)s
+WHERE id = %(id)s
+"""
 
 GET_OLDACTIVE_CASES_4_ADMIN = """
 SELECT m.id, s.zugriff, getLastCaseAppointment(m.id) AS last_date
 FROM
   (SELECT * FROM ka_status_tbl_view
    WHERE zugriff < now() - interval '1 day' * %(maxdays)s AND status <> 5) s
-   JOIN master_tbl_view m ON m.id = s.master_id 
-   WHERE phase in (-1,0,1)
+   JOIN master_tbl_view m ON m.id = s.master_id
+WHERE phase in (-1, 0, 1)
 """
 GET_OLDACTIVE_CASES = """
 SELECT m.id, s.zugriff, getLastCaseAppointment(m.id) AS last_date
 FROM
   (SELECT * FROM ka_status_tbl_view
    WHERE zugriff < now() - interval '1 day' * %(maxdays)s AND status <> 5) s
-   JOIN master_tbl_view m ON m.id = s.master_id 
-   WHERE phase in  (-1,0,1) 
-       AND m.bearbeiter_id = %(editor)s
+   JOIN master_tbl_view m ON m.id = s.master_id
+WHERE phase in  (-1, 0, 1) AND m.bearbeiter_id = %(editor)s
 """
 
-GET_OLDFINISHED_CASES_4_ADMIN = """SELECT m.id, s.zugriff, 
-getLastCaseAppointment(m.id) as last_date 
-from master_tbl_view m 
-JOIN ka_status_tbl_view s 
-ON s.master_id = m.id 
+GET_OLDFINISHED_CASES_4_ADMIN = """\
+SELECT m.id, s.zugriff, getLastCaseAppointment(m.id) as last_date
+FROM master_tbl_view m JOIN ka_status_tbl_view s ON s.master_id = m.id
 WHERE s.status <> 5
-AND extract(day from now()-s.zugriff) > %(maxdays)s 
-AND phase in (2,3,4)"""
+      AND extract(day from now()-s.zugriff) > %(maxdays)s
+      AND phase in (2, 3, 4)
+"""
 
-GET_OLDFINISHED_CASES = """SELECT m.id, s.zugriff, 
-getLastCaseAppointment(m.id) as last_date 
-from master_tbl_view m 
-JOIN ka_status_tbl_view s 
-ON s.master_id = m.id 
+GET_OLDFINISHED_CASES = """\
+SELECT m.id, s.zugriff, getLastCaseAppointment(m.id) as last_date
+FROM master_tbl_view m JOIN ka_status_tbl_view s ON s.master_id = m.id
 WHERE s.status <> 5
-AND m.bearbeiter_id = %(editor)s
-AND extract(day from now()-s.zugriff) > %(maxdays)s 
-AND phase in (2,3,4)"""
+      AND m.bearbeiter_id = %(editor)s
+      AND extract(day from now()-s.zugriff) > %(maxdays)s
+      AND phase in (2, 3, 4)
+"""
 
-#class AppointmentBundle:
-#    def __init__(self, ids):
-#        self.list = []
-#        factory = ()
-#        for id in ids:
-#            self.list.append(factory.loadId(id))
-#
-#    def delete(self):
-#        num = 0
-#        for appointment in self.list:
-#            appointment.delete()
-#            num += 1
-#        return num
-#
-#    def isEmpty(self):
-#        return len(self.list) <= 0 
-#
-#    def getAppointments(self):
-#       return self.list
 
 class AppointmentFactory:
 
@@ -150,7 +160,8 @@
             db.recycleConnection(conn, cur)
         return appointment
 
-    def createByData(self, id=None, title=None, sdate=None, edate=None, desc=None, case_id=None, type=0):
+    def createByData(self, id=None, title=None, sdate=None, edate=None,
+                     desc=None, case_id=None, type=0):
         appointment             = self.constructor()
         appointment.id          = id
         appointment.start_date  = sdate
@@ -186,32 +197,40 @@
             db.recycleConnection(conn, cur)
         return None
 
+
 class CaseAppointmentFactory(AppointmentFactory):
+
     def __init__(self):
         self.get_sql = GET_CASE_APPOINTMENT_SQL
         self.create_sql = CREATE_CASE_APPOINTMENT_SQL
         self.constructor = CaseAppointment
 
+
 class CaseReminderFactory(AppointmentFactory):
+
     def __init__(self):
         self.get_sql = GET_CASE_APPOINTMENT_SQL
         self.create_sql = CREATE_CASE_APPOINTMENT_SQL
         self.constructor = CaseReminder
 
+
 class GlobalAppointmentFactory(AppointmentFactory):
+
     def __init__(self):
         self.get_sql = GET_GLOBAL_APPOINTMENT_SQL
         self.create_sql = CREATE_GLOBAL_APPOINTMENT_SQL
         self.constructor = GlobalAppointment
 
+
 class AppointmentOverview:
+
     def _load(self, factory, sql, values):
         self.appointment_list = []
         conn, cur = None, None
         try:
             conn = db.getConnection()
             cur = conn.cursor()
-            cur.execute(sql, values )
+            cur.execute(sql, values)
             rows = cur.fetchall()
             for row in rows:
                 self.appointment_list.append(factory.createByDBRow(row))
@@ -230,10 +249,13 @@
     def sort(self, cmp=None):
         self.appointment_list = sorted(self.appointment_list)
 
+
 class CaseAppointmentOverview(AppointmentOverview):
+
     def __init__(self, caseid=None):
         afactory = CaseAppointmentFactory()
-        today = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)
+        today = datetime.now().replace(hour=0, minute=0, second=0,
+                                       microsecond=0)
         if caseid:
             values = {'id': caseid, 'date': today}
             sql = GET_CASE_APPOINTMENTLIST_SQL
@@ -243,18 +265,24 @@
             sql = GET_ALLCASES_APPOINTMENTLIST_SQL
         self._load(afactory, sql, values)
 
+
 class GlobalAppointmentOverview(AppointmentOverview):
+
     def __init__(self):
         afactory = GlobalAppointmentFactory()
-        today = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)
+        today = datetime.now().replace(hour=0, minute=0, second=0,
+                                       microsecond=0)
         values = {'date': today}
         sql = GET_GLOBAL_APPOINTMENTLIST_SQL
         self._load(afactory, sql, values)
 
+
 class CaseReminderOverview(AppointmentOverview):
+
     def __init__(self, caseid=None):
         afactory = CaseReminderFactory()
-        today = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)
+        today = datetime.now().replace(hour=0, minute=0, second=0,
+                                       microsecond=0)
         if caseid:
             values = {'id': caseid, 'date': today}
             sql = GET_CASE_REMINDERLIST_SQL
@@ -264,44 +292,51 @@
             sql = GET_ALLCASES_REMINDERLIST_SQL
         self._load(afactory, sql, values)
 
+
 class MaxSaveTimeReminderOverview(AppointmentOverview):
+
     def __init__(self):
         self.appointment_list = []
-        agency                = Agency()
-        maxage                = agency.getMaxSavetime()
-        cases                 = CaseOverview()
-        user                  = session['USER_AUTHORIZED']
+        agency = Agency()
+        maxage = agency.getMaxSavetime()
+        cases = CaseOverview()
+        user = session['USER_AUTHORIZED']
 
         # 0. Load ids and some additional info on cases which either are active
         # but seems to be orphaned or are finished and not edited for
         # longer than maxage.
         # orphaned means that all last appointmentment, aids or the
         # modification date is older than maxage
-        oldAndActive          = self.__getOldAndActiveCases(maxage, user)
-        oldAndFinished        = self.__getOldAndFinishedCases(maxage, user)
+        oldAndActive = self.__getOldAndActiveCases(maxage, user)
+        oldAndFinished = self.__getOldAndFinishedCases(maxage, user)
 
         # 1. Load cases of the user so we can so checks regarding the maximum
         # savetime on them
-        default_search_options = ['own:%s' % user.id, 'standin:%s' % user.id, 'state:1', 'state:2', 'state:3']
+        default_search_options = ['own:%s' % user.id, 'standin:%s' % user.id,
+                                  'state:1', 'state:2', 'state:3']
         cases.search(";".join(default_search_options))
 
         # 2. filter cases which seems to be orphaned and create reminders
         oldAndActiveSet = set(oldAndActive)
-        old_cases = [case for case in cases.getDatasets() if case.id in oldAndActiveSet]
+        old_cases = [case for case in cases.getDatasets()
+                          if case.id in oldAndActiveSet]
         for case in old_cases:
             info = oldAndActive[case.id]
-            last  = info['last_date']
-            appointment = self.__makeAppointment(case, last, maxage, finished=False)
+            last = info['last_date']
+            appointment = self.__makeAppointment(case, last, maxage,
+                                                 finished=False)
             self.appointment_list.append(appointment)
 
 
         # 3. filter cases which are finished and not edited and create reminders
         oldAndFinishedSet = set(oldAndFinished)
-        old_cases = [case for case in cases.getDatasets() if case.id in oldAndFinishedSet]
+        old_cases = [case for case in cases.getDatasets()
+                          if case.id in oldAndFinishedSet]
         for case in old_cases:
             info = oldAndFinished[case.id]
             access = info['access']
-            appointment = self.__makeAppointment(case, access, maxage, finished=True)
+            appointment = self.__makeAppointment(case, access, maxage,
+                                                 finished=True)
             self.appointment_list.append(appointment)
 
     def __getOldAndFinishedCases(self, days, user):
@@ -313,7 +348,8 @@
             if user.isAdmin():
                 cur.execute(GET_OLDFINISHED_CASES_4_ADMIN, {'maxdays': days})
             else:
-                cur.execute(GET_OLDFINISHED_CASES, {'maxdays': days, 'editor': user.id})
+                cur.execute(GET_OLDFINISHED_CASES, {'maxdays': days,
+                                                    'editor': user.id})
             result = cur.fetchall()
             for r in result:
                 list[r[0]] = {'access':r[1], 'last_date': r[2]}
@@ -329,9 +365,11 @@
             conn = db.getConnection()
             cur = conn.cursor()
             if user.isAdmin():
-                cur.execute(GET_OLDACTIVE_CASES_4_ADMIN, {'maxdays': days, 'editor': user.id})
+                cur.execute(GET_OLDACTIVE_CASES_4_ADMIN, {'maxdays': days,
+                                                          'editor': user.id})
             else:
-                cur.execute(GET_OLDACTIVE_CASES, {'maxdays': days, 'editor': user.id})
+                cur.execute(GET_OLDACTIVE_CASES, {'maxdays': days,
+                                                  'editor': user.id})
             result = cur.fetchall()
             for r in result:
                 list[r[0]] = {'access':r[1], 'last_date': r[2]}
@@ -341,37 +379,36 @@
         return False
 
     def __makeAppointment(self, case, last_date, maxage, finished):
-        factory  = CaseAppointmentFactory()
-        type     = 1
-        title    = u"%s, %s" % (case.last_name, case.first_name)
-        age      = datetime.now() - last_date 
-        mydate   = datetime.now() - timedelta(age.days-int(maxage))
+        factory = CaseAppointmentFactory()
+        type = 1
+        title = u"%s, %s" % (case.last_name, case.first_name)
+        age = datetime.now() - last_date
+        mydate = datetime.now() - timedelta(age.days-int(maxage))
         if finished:
-            desc = u"Achtung! Die maximale Speicherdauer von (%s Tagen) ist seit  \
-                    %s Tagen für diese Fallakte überschritten!" % (maxage, age.days-int(maxage))
+            desc = (u"Achtung! Die maximale Speicherdauer von (%s Tagen)"
+                    u" ist seit %s Tagen für diese Fallakte überschritten!"
+                    % (maxage, age.days-int(maxage)))
         else:
-            desc = u"Inaktive Fallakte? Bitte prüfen Sie, ob der Fall noch bearbeitet wird." 
-        appointment = factory.createByData(None, 
-                                           title,
-                                           mydate,
-                                           None,
-                                           desc,
-                                           case.id,
-                                           type)
+            desc = (u"Inaktive Fallakte? Bitte prüfen Sie,"
+                    u" ob der Fall noch bearbeitet wird.")
+        appointment = factory.createByData(None, title, mydate, None, desc,
+                                           case.id, type)
         return appointment
 
+
 class Appointment:
+
     def __init__(self):
-        self.id          = None
-        self.title       = None
-        self.start_date  = None
-        self.end_date    = None
+        self.id = None
+        self.title = None
+        self.start_date = None
+        self.end_date = None
         self.description = None
-        self.case_id     = None
+        self.case_id = None
         # available types
         # 0: normal appointment
         # 1: Reminder
-        self.type        = 0
+        self.type = 0
 
     def __cmp__(self, other):
         return cmp(self.start_date, other.start_date)
@@ -380,14 +417,14 @@
         str = str.strip()
         date, time = str.split(' ')
         try:
-            d,m,Y = date.split('.')
-        except: 
+            d, m, Y = date.split('.')
+        except:
             return None
         try:
-            H,M = time.split(':')
+            H, M = time.split(':')
         except:
-            H,M = (0,0)
-        return datetime(int(Y),int(m),int(d),int(H),int(M))
+            H, M = (0, 0)
+        return datetime(int(Y), int(m), int(d), int(H), int(M))
 
     def getStartDate(self):
         return self.start_date
@@ -401,36 +438,36 @@
         return empty
 
     def setData(self, data):
-        '''Sets values of the appointment to data. Data is a dict returned from formencode'''
+        """Sets values of the appointment to data.
+        Data is a dict returned from formencode
+        """
         self.title = data.get('title', self.title)
-        self.type  = data.get('type', self.type)
+        self.type = data.get('type', self.type)
 
         # Set date
         sdate = "%s %s" % (data.get('start_date'), data.get('start_time'))
         self.start_date = self._convertStr2Date(sdate)
 
-        ## If not end_date is given, than end_date is equal to start_date 
+        ## If not end_date is given, than end_date is equal to start_date
         #if not data.get('end_date') or not data.get('end_time'):
         #    self.end_date   = self.start_date
         #else:
         #    edate = "%s %s" % (data.get('end_date'), data.get('end_time'))
         #    self.end_date   = self._convertStr2Date(edate)
-        
+
         edate = "%s %s" % (data.get('end_date'), data.get('end_time'))
-        self.end_date   = self._convertStr2Date(edate)
+        self.end_date = self._convertStr2Date(edate)
 
         self.description = data.get('description', self.description)
         self.case_id = data.get('case_id', self.case_id)
 
     def store(self):
         conn, cur = None, None
-        fields = {'id': self.id, \
-                'title': self.title, \
-                'start_date': self.start_date, \
-                'end_date': self.end_date, \
-                'description': self.description, \
-                'type': self.type, \
-                'case_id': self.case_id}
+        fields = {'id': self.id, 'case_id': self.case_id,
+                  'type': self.type,
+                  'title': self.title, 'description': self.description,
+                  'start_date': self.start_date, 'end_date': self.end_date,
+                  }
         try:
             conn = db.getConnection()
             cur = conn.cursor()
@@ -459,21 +496,27 @@
             db.recycleConnection(conn, cur)
         return False
 
+
 class GlobalAppointment(Appointment):
+
     def __init__(self):
         Appointment.__init__(self)
         self.type = 0
-        self.store_sql  = STORE_GLOBAL_APPOINTMENT_SQL
+        self.store_sql = STORE_GLOBAL_APPOINTMENT_SQL
         self.delete_sql = DELETE_GLOBAL_APPOINTMENT_SQL
 
+
 class CaseAppointment(Appointment):
+
     def __init__(self):
         Appointment.__init__(self)
         self.type = 0
-        self.store_sql  = STORE_CASE_APPOINTMENT_SQL
+        self.store_sql = STORE_CASE_APPOINTMENT_SQL
         self.delete_sql = DELETE_CASE_APPOINTMENT_SQL
 
+
 class CaseReminder(CaseAppointment):
+
     def __init__(self):
         CaseAppointment.__init__(self)
         self.type = 1



More information about the Mpuls-commits mailing list