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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Feb 11 20:12:09 CET 2010


Author: bh
Date: 2010-02-11 20:12:07 +0100 (Thu, 11 Feb 2010)
New Revision: 1524

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/waskaweb/model/case.py
Log:
* waskaweb/model/case.py (Field.__init__): New parameters and
instance variables: search_retrieve and search_match.  These
indicate whether the field is should be retrieved from a search
and whether the search string should be matched agains the field's
value.
(Case.get_search_retrieve_fields, Case.get_search_match_fields):
New.  Return lists of field names to retrieve in a search or to
match in search, according to the new Field attributes.


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-02-11 19:00:59 UTC (rev 1523)
+++ wasko/branches/2.0/ChangeLog	2010-02-11 19:12:07 UTC (rev 1524)
@@ -1,5 +1,16 @@
 2010-02-11  Bernhard Herzog  <bh at intevation.de>
 
+	* waskaweb/model/case.py (Field.__init__): New parameters and
+	instance variables: search_retrieve and search_match.  These
+	indicate whether the field is should be retrieved from a search
+	and whether the search string should be matched agains the field's
+	value.
+	(Case.get_search_retrieve_fields, Case.get_search_match_fields):
+	New.  Return lists of field names to retrieve in a search or to
+	match in search, according to the new Field attributes.
+
+2010-02-11  Bernhard Herzog  <bh at intevation.de>
+
 	* waskaweb/templates/casemanagement/digest_body.mako: Use the
 	case's get_digest_fields() method to retrieve the list of fields
 	to show in the digest instead of using a hard-wired list.

Modified: wasko/branches/2.0/waskaweb/model/case.py
===================================================================
--- wasko/branches/2.0/waskaweb/model/case.py	2010-02-11 19:00:59 UTC (rev 1523)
+++ wasko/branches/2.0/waskaweb/model/case.py	2010-02-11 19:12:07 UTC (rev 1524)
@@ -619,6 +619,16 @@
        digest -- If true (default false), the field will be listed in
                the default case digest.
 
+       search_retrieve -- If true (default false), the field will be
+               returned from a search.  This only works if the name is a
+               column of the master table.
+
+       search_match -- If true (default false), the search string
+               entered by the user will be matched against the value of
+               this field.  This will only work if the name is a column
+               of the master table.  search_match and search_retrieve
+               are completely independent settings.
+
        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
@@ -636,10 +646,14 @@
     """
 
 
-    def __init__(self, name, digest=False, session=False, alias=None,
-                 alias_force_string=True):
+    def __init__(self, name, digest=False,
+                 search_retrieve=False, search_match=False,
+                 session=False, alias=None, alias_force_string=True):
         self.name = name
         self.digest = digest
+        self.search_retrieve = search_retrieve
+        self.search_match = search_match
+
         self.session = session
         self.alias = alias
         self.alias_force_string = alias_force_string
@@ -754,6 +768,16 @@
         """Return a list describing all fields shown in the digest."""
         return [field for field in cls.fields if field.digest]
 
+    @classmethod
+    def get_search_retrieve_fields(cls):
+        """Return a list with all names of fields to retrieve from the search"""
+        return [field.name for field in cls.fields if field.search_retrieve]
+
+    @classmethod
+    def get_search_match_fields(cls):
+        """Return a list with all names of fields to match in the search"""
+        return [field.name for field in cls.fields if field.search_match]
+
     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