[Mpuls-commits] r2251 - in wasko/branches/2.0: . mpulsweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Mar 29 18:26:30 CEST 2010
Author: bh
Date: 2010-03-29 18:26:29 +0200 (Mon, 29 Mar 2010)
New Revision: 2251
Modified:
wasko/branches/2.0/ChangeLog
wasko/branches/2.0/mpulsweb/model/appointment.py
Log:
* mpulsweb/model/appointment.py: Fix formatting.
Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog 2010-03-29 16:15:47 UTC (rev 2250)
+++ wasko/branches/2.0/ChangeLog 2010-03-29 16:26:29 UTC (rev 2251)
@@ -1,5 +1,9 @@
2010-03-29 Bernhard Herzog <bh at intevation.de>
+ * mpulsweb/model/appointment.py: Fix formatting.
+
+2010-03-29 Bernhard Herzog <bh at intevation.de>
+
* mpulsweb/model/agencysettings.py: Remove unused imports.
2010-03-29 Bernhard Herzog <bh at intevation.de>
Modified: wasko/branches/2.0/mpulsweb/model/appointment.py
===================================================================
--- wasko/branches/2.0/mpulsweb/model/appointment.py 2010-03-29 16:15:47 UTC (rev 2250)
+++ wasko/branches/2.0/mpulsweb/model/appointment.py 2010-03-29 16:26:29 UTC (rev 2251)
@@ -29,7 +29,6 @@
#
import logging
-
from datetime import datetime, timedelta
import mpulsweb.lib.helpers as h
@@ -38,6 +37,7 @@
from mpulsweb.model.case import MpulsCaseOverview
from mpulsweb.model.agencysettings import Agency
+
GET_GLOBAL_APPOINTMENT_SQL = """\
SELECT id, master_id, sdatum, edatum, name, beschreibung, art
FROM ka_global_termine_tbl_view
@@ -148,6 +148,7 @@
log = logging.getLogger(__name__)
+
class AppointmentFactory:
def loadById(self, id):
@@ -164,24 +165,24 @@
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
- appointment.end_date = edate
- appointment.title = title
+ appointment = self.constructor()
+ appointment.id = id
+ appointment.start_date = sdate
+ appointment.end_date = edate
+ appointment.title = title
appointment.description = desc
- appointment.case_id = case_id
- appointment.type = type
+ appointment.case_id = case_id
+ appointment.type = type
return appointment
def createByDBRow(self, row):
- id = row[0]
+ id = row[0]
master_id = row[1]
- sdate = row[2]
- edate = row[3]
- name = h.ensure_unicode(row[4])
- desc = h.ensure_unicode(row[5])
- type = row[6]
+ sdate = row[2]
+ edate = row[3]
+ name = h.ensure_unicode(row[4])
+ desc = h.ensure_unicode(row[5])
+ type = row[6]
return self.createByData(id, name, sdate, edate, desc, master_id, type)
def createNew(self, case_id=None):
@@ -294,6 +295,7 @@
sql = GET_ALLCASES_REMINDERLIST_SQL
self._load(afactory, sql, values)
+
class Appointment:
def __init__(self):
@@ -336,7 +338,7 @@
return None
# If no time id provided set to 00:00:00
- try:
+ try:
H = mtime.hour
M = mtime.minute
S = mtime.second
@@ -344,7 +346,7 @@
H = 0
M = 0
S = 0
- return datetime(y,m,d,H,M,S)
+ return datetime(y, m, d, H, M, S)
except Exception, e:
log.error(e)
@@ -369,19 +371,18 @@
self.type = data.get('type', self.type)
# Set date
- self.start_date = self._convert2Datetime(
- data.get('start_date'), data.get('start_time'))
+ self.start_date = self._convert2Datetime(data.get('start_date'),
+ data.get('start_time'))
- self.end_date = self._convert2Datetime(
- data.get('end_date'), data.get('end_time'))
+ self.end_date = self._convert2Datetime(data.get('end_date'),
+ data.get('end_time'))
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, 'case_id': self.case_id,
- 'type': self.type,
+ 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,
}
@@ -468,7 +469,7 @@
# 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]
+ if case.id in oldAndActiveSet]
for case in old_cases:
info = oldAndActive[case.id]
last = info['last_date']
@@ -480,7 +481,7 @@
# 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]
+ if case.id in oldAndFinishedSet]
for case in old_cases:
info = oldAndFinished[case.id]
access = info['access']
@@ -495,16 +496,14 @@
conn = db.getConnection()
cur = conn.cursor()
if user.isAdmin():
- sql = GET_OLDFINISHED_CASES_4_ADMIN % \
- ",".join(g.mpuls_config.get('phases', 'finished'))
- cur.execute(sql,
- {'maxdays': days})
+ sql = (GET_OLDFINISHED_CASES_4_ADMIN
+ % ",".join(g.mpuls_config.get('phases', 'finished')))
+ cur.execute(sql,
+ {'maxdays': days})
else:
- sql = GET_OLDFINISHED_CASES % \
- ",".join(g.mpuls_config.get('phases', 'finished'))
- cur.execute(sql,
- {'maxdays': days,
- 'editor': user.id})
+ sql = (GET_OLDFINISHED_CASES
+ % ",".join(g.mpuls_config.get('phases', 'finished')))
+ cur.execute(sql, {'maxdays': days, 'editor': user.id})
result = cur.fetchall()
for r in result:
list[r[0]] = {'access':r[1], 'last_date': r[2]}
@@ -520,15 +519,13 @@
conn = db.getConnection()
cur = conn.cursor()
if user.isAdmin():
- sql = GET_OLDACTIVE_CASES_4_ADMIN % ",".join(g.mpuls_config.get('phases', 'active'))
- cur.execute(sql,
- {'maxdays': days,
- 'editor': user.id})
+ sql = (GET_OLDACTIVE_CASES_4_ADMIN
+ % ",".join(g.mpuls_config.get('phases', 'active')))
+ cur.execute(sql, {'maxdays': days, 'editor': user.id})
else:
- sql = GET_OLDACTIVE_CASES % ",".join(g.mpuls_config.get('phases', 'active'))
- cur.execute(sql,
- {'maxdays': days,
- 'editor': user.id})
+ sql = (GET_OLDACTIVE_CASES
+ % ",".join(g.mpuls_config.get('phases', 'active')))
+ cur.execute(sql, {'maxdays': days, 'editor': user.id})
result = cur.fetchall()
for r in result:
list[r[0]] = {'access':r[1], 'last_date': r[2]}
@@ -542,7 +539,7 @@
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))
+ mydate = datetime.now() - timedelta(age.days - int(maxage))
if finished:
desc = (u"Achtung! Die maximale Speicherdauer von (%s Tagen)"
u" ist seit %s Tagen für diese Fallakte überschritten!"
More information about the Mpuls-commits
mailing list