[Mpuls-commits] r326 - in wasko/trunk: . waskaweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Mar 4 14:32:06 CET 2009


Author: torsten
Date: 2009-03-04 14:32:03 +0100 (Wed, 04 Mar 2009)
New Revision: 326

Modified:
   wasko/trunk/ChangeLog.txt
   wasko/trunk/waskaweb/model/logbook.py
Log:
Store full username in logbook


Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt	2009-03-04 12:08:43 UTC (rev 325)
+++ wasko/trunk/ChangeLog.txt	2009-03-04 13:32:03 UTC (rev 326)
@@ -1,3 +1,10 @@
+2009-03-04	Torsten Irlaender  <torsten.irlaender at intevation.de> 
+
+	Store full username in logboook instead of user id
+
+	* waskaweb/model/logbook.py: Do not update editor when saving a
+	  logbook.
+
 2009-03-04	Sascha L. Teichmann	<teichmann at intevation.de>
 
 	* waskaweb/model/casexml.py: Store logbook entries to data base.

Modified: wasko/trunk/waskaweb/model/logbook.py
===================================================================
--- wasko/trunk/waskaweb/model/logbook.py	2009-03-04 12:08:43 UTC (rev 325)
+++ wasko/trunk/waskaweb/model/logbook.py	2009-03-04 13:32:03 UTC (rev 326)
@@ -71,20 +71,16 @@
     'avg_cat4': u'Keine Angabe',
      'avg_all': u'Gesamt' }
 
-ALLOWED_SORTING = ['nachname', 'vorname', 'art', 'dauer', 'datum', 'asc', 'desc']
+ALLOWED_SORTING = ['name', 'art', 'dauer', 'datum', 'asc', 'desc']
 LOAD_LOGBOOK = """
-SELECT l.id AS id, datum, b.vorname AS vorname, b.nachname AS nachname, art, kurz_notiz, notiz, dauer
-FROM ka_logbuch_tbl_view l LEFT JOIN ka_benutzer_tbl_view b
-ON l.bearbeiter = b.id
-WHERE l.master_id = %s
+SELECT l.id AS id, datum, bearbeiter, art, kurz_notiz, notiz, dauer
+FROM ka_logbuch_tbl_view l WHERE l.master_id = %s
 ORDER BY %s %s 
 """
 
 LOAD_LOGBOOK_BY_ID = """
-SELECT l.id AS id, datum, b.vorname AS vorname, b.nachname AS nachname, art, kurz_notiz, notiz, dauer
-FROM ka_logbuch_tbl_view l LEFT JOIN ka_benutzer_tbl_view b
-ON l.bearbeiter = b.id
-WHERE l.id = %(mid)s
+SELECT l.id AS id, datum, bearbeiter, art, kurz_notiz, notiz, dauer
+FROM ka_logbuch_tbl_view l WHERE l.id = %(mid)s
 """
 
 CREATE_LOGBOOK_ENTRY = """
@@ -98,7 +94,6 @@
 UPDATE_LOGBOOK_ENTRY = """
 UPDATE ka_logbuch_tbl_view SET 
     datum      = %(date)s, 
-    bearbeiter = %(editor)s, 
     art        = %(kind)s,
     kurz_notiz = %(short_notice)s,
     notiz      = %(notice)s,
@@ -112,8 +107,7 @@
         self.id                  = None
         self.datum               = None
         self.art                 = None
-        self.bearbeiter_vorname  = None
-        self.bearbeiter_nachname = None
+        self.bearbeiter_name     = None
         self.kurz_notiz          = None
         self.notiz               = None
         self.dauer               = None
@@ -121,12 +115,11 @@
     def setByRow(self, row):
         self.id                  = row[0]
         self.datum               = row[1]
-        self.bearbeiter_vorname  = row[2] and unicode(str(row[2]), 'UTF-8') or None
-        self.bearbeiter_nachname = row[3] and unicode(str(row[3]), 'UTF-8') or None
-        self.art                 = row[4]
-        self.kurz_notiz          = row[5] and unicode(str(row[5]), 'UTF-8') or None
-        self.notiz               = row[6] and unicode(str(row[6]), 'UTF-8') or None
-        self.dauer               = row[7]
+        self.bearbeiter_name     = row[2] and unicode(str(row[2]), 'UTF-8') or None
+        self.art                 = row[3]
+        self.kurz_notiz          = row[4] and unicode(str(row[4]), 'UTF-8') or None
+        self.notiz               = row[5] and unicode(str(row[5]), 'UTF-8') or None
+        self.dauer               = row[6]
 
     def loadById(self, id):
         self.id = id
@@ -158,19 +151,8 @@
         self.datum = datum
 
     def getEditor(self):
-        name = []
-        if self.bearbeiter_nachname:
-            name.append(self.bearbeiter_nachname)
+        return self.bearbeiter_name
 
-        if self.bearbeiter_vorname:
-            name.append(", ")
-            name.append(self.bearbeiter_vorname[0])
-            name.append(".")
-
-        if not name: return ""
-
-        return "".join(name)
-
     def getKind(self, empty='-/-'):
         if self.art == -2:
             return "%s" % self.getShortNotice(empty)
@@ -217,7 +199,6 @@
 
         cur.execute(UPDATE_LOGBOOK_ENTRY, {
             "date"        : self.datum,
-            "editor"      : uid,
             "kind"        : self.art,
             "short_notice": self.kurz_notiz,
             "notice"      : self.notiz,
@@ -231,7 +212,6 @@
             cur  = conn.cursor()
             cur.execute(UPDATE_LOGBOOK_ENTRY, {
                 "date"        : self.datum,
-                "editor"      : uid,
                 "kind"        : self.art,
                 "short_notice": self.kurz_notiz,
                 "notice"      : self.notiz,



More information about the Mpuls-commits mailing list