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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Feb 11 19:59:41 CET 2010


Author: bh
Date: 2010-02-11 19:59:34 +0100 (Thu, 11 Feb 2010)
New Revision: 1522

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/waskaweb/model/case.py
Log:
* waskaweb/model/case.py (Field.__init__): New parameter and
instance variable: digest.  Indicates whether the field is listed
in the case digest.
(Case.fields): Set digest where appropriate for wasko.  Add some
more fields so that all fields currently shown in the digest are
listed.
(Case.get_digest_fields): New method to return a list of the
digest fields.


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-02-11 18:30:19 UTC (rev 1521)
+++ wasko/branches/2.0/ChangeLog	2010-02-11 18:59:34 UTC (rev 1522)
@@ -1,5 +1,16 @@
 2010-02-11  Bernhard Herzog  <bh at intevation.de>
 
+	* waskaweb/model/case.py (Field.__init__): New parameter and
+	instance variable: digest.  Indicates whether the field is listed
+	in the case digest.
+	(Case.fields): Set digest where appropriate for wasko.  Add some
+	more fields so that all fields currently shown in the digest are
+	listed.
+	(Case.get_digest_fields): New method to return a list of the
+	digest fields.
+
+2010-02-11  Bernhard Herzog  <bh at intevation.de>
+
 	* waskaweb/model/case.py (AliasDescription, Field): Replace
 	AliasDescription with the similar but more general Field.
 	(Case.aliases, Case.fields): Replace aliases with fields, which is

Modified: wasko/branches/2.0/waskaweb/model/case.py
===================================================================
--- wasko/branches/2.0/waskaweb/model/case.py	2010-02-11 18:30:19 UTC (rev 1521)
+++ wasko/branches/2.0/waskaweb/model/case.py	2010-02-11 18:59:34 UTC (rev 1522)
@@ -616,6 +616,9 @@
                The value of the field can be fetched with the case
                object's get_value method
 
+       digest -- If true (default false), the field will be listed in
+               the default case digest.
+
        alias -- Additional name under which the attribute can be
                accessed directly as an attribute of the case object.
                Default is None, which means that the field is not
@@ -633,9 +636,10 @@
     """
 
 
-    def __init__(self, name, session=False, alias=None,
+    def __init__(self, name, digest=False, session=False, alias=None,
                  alias_force_string=True):
         self.name = name
+        self.digest = digest
         self.session = session
         self.alias = alias
         self.alias_force_string = alias_force_string
@@ -665,18 +669,37 @@
     # Definitions for some commonly used public instance attributes.
     #
     fields = [
-        Field("fn", alias="knr", alias_force_string=True, session=True),
-        Field("name", alias="last_name", alias_force_string=True, session=True),
-        Field("vorname", alias="first_name", alias_force_string=True,
-              session=True),
-        Field("adresse_strasse", alias="street", alias_force_string=True,
-              session=True),
-        Field("adresse_strassenr", alias="streetnr", alias_force_string=True,
-              session=True),
-        Field("adresse_plz", alias="plz", alias_force_string=True,
-              session=True),
-        Field("adresse_ort", alias="city", alias_force_string=True,
-              session=True),
+        Field("name", digest=True,
+              alias="last_name", alias_force_string=True, session=True),
+        Field("vorname", digest=True,
+              alias="first_name", alias_force_string=True, session=True),
+        Field("fn", digest=True,
+              alias="knr", alias_force_string=True, session=True),
+        Field("geburtsdatum", digest=True),
+        Field("addresse_strasse", digest=True,
+              alias="street", alias_force_string=True, session=True),
+        Field("addresse_strassenr", digest=True,
+              alias="streetnr", alias_force_string=True, session=True),
+        Field("addresse_plz", digest=True,
+              alias="plz", alias_force_string=True, session=True),
+        Field("addresse_ort", digest=True,
+              alias="city", alias_force_string=True, session=True),
+
+        Field("addresse_vorwahl", digest=True),
+        Field("addresse_telefonnummer", digest=True),
+        Field("addresse_weiteretelefonnummern", digest=True),
+        Field("addresse_email", digest=True),
+        Field("mutter_vn", digest=True),
+        Field("mutter_n", digest=True),
+        Field("mutter_vorwahl", digest=True),
+        Field("mutter_telefonnummer", digest=True),
+        Field("mutter_email", digest=True),
+        Field("vater_vn", digest=True),
+        Field("vater_n", digest=True),
+        Field("vater_vorwahl", digest=True),
+        Field("vater_telefonnummer", digest=True),
+        Field("vater_email", digest=True),
+
         Field("erstgespraech", alias="first_meeting", session=True),
         Field("datum_cm_ende", alias="cm_end", session=True),
         Field("bearbeiter_id", alias="editor", session=False),
@@ -726,6 +749,11 @@
         """
         return [field for field in cls.fields if field.session and field.alias]
 
+    @classmethod
+    def get_digest_fields(cls):
+        """Return a list describing all fields shown in the digest."""
+        return [field for field in cls.fields if field.digest]
+
     def get_value(self, name, **kw):
         """Return the value of the formed field given by name.
         If the formed instance of the case has not yet been loaded, the



More information about the Mpuls-commits mailing list