bug severity verification now works with per-tree severities.
authorW. Trevor King <wking@drexel.edu>
Thu, 4 Dec 2008 15:32:10 +0000 (10:32 -0500)
committerW. Trevor King <wking@drexel.edu>
Thu, 4 Dec 2008 15:32:10 +0000 (10:32 -0500)
I adjusted the YAML format following
  http://pyyaml.org/ticket/11
  Unicode support
To remove '!!python/unicode' escapes and allow unicode in the output.
We can always have unicode in the output because the output is encoded
(as per the BugFile.encoding setting) before being sent to the outside
world.

.be/bugs/4a4609c8-1882-47de-9d30-fee410b8a802/values
.be/settings
libbe/bug.py
libbe/mapfile.py

index 5d081cfdd94a5c9261c5dda90575ce7e2bfed7f8..82ba2365a3c9000186d01f9044d12720a68491c9 100644 (file)
@@ -1,35 +1,14 @@
+creator: abentley
 
 
+severity: moderate
 
-creator=abentley
 
+status: open
 
 
+summary: Do we need a severity between serious and minor? EG "Moderate"?
 
 
-
-severity=serious
-
-
-
-
-
-
-status=open
-
-
-
-
-
-
-summary=Do we need a severity between serious and minor? EG "Moderate"?
-
-
-
-
-
-
-time=Wed, 25 Jan 2006 23:14:07 +0000
-
-
+time: Wed, 25 Jan 2006 23:14:07 +0000
 
index 26f81cdddbd148040849e096465b877861d52384..807b33c2f88c752b3ac489ec19d6d6e68f4a5eb5 100644 (file)
@@ -1,15 +1,17 @@
 rcs_name: bzr
 
+
 severities:
-- name: wishlist
-  description: A feature that could improve usefulness, but not a bug.
-- name: minor
-  description: The standard bug level.
-- name: moderate
-  description: Yet another bug severity.
-- name: serious
-  description: A bug that requires workarounds.
-- name: critical
-  description: A bug that prevents some features from working at all.
-- name: fatal
-  description: A bug that makes the package unusable.
+- - wishlist
+  - A feature that could improve usefulness, but not a bug.
+- - minor
+  - The standard bug level.
+- - moderate
+  - Yet another bug severity.
+- - serious
+  - A bug that requires workarounds.
+- - critical
+  - A bug that prevents some features from working at all.
+- - fatal
+  - A bug that makes the package unusable.
+
index 46f244f46bec2c94f562828aef595149b01817cf..2cd05e349b2d7911d9746a903a497fdd214091c6 100644 (file)
@@ -65,10 +65,6 @@ def load_severities(severity_def):
     global severity_values
     global severity_description
     global severity_index
-    if type(severity_def[0]) == dict:
-        # Convert {"name": "X", "description": "Y"} severities to ("X","Y").
-        # The dict form is loaded from the per-tree settings file.
-        severity_def = [(d["name"], d["description"]) for d in severity_def]
     severity_values = tuple([val for val,description in severity_def])
     severity_description = dict(severity_def)
     severity_index = {}
@@ -125,7 +121,7 @@ class Bug(settings_object.SavedSettingsObject):
     @_versioned_property(name="severity",
                          doc="A measure of the bug's importance",
                          default="minor",
-                         allowed=severity_values,
+                         check_fn=lambda s: s in severity_values,
                          require_save=True)
     def severity(): return {}
 
index a84cca3ae332555f092405b93fd8dc52beb92b86..f53f72c3dd0e559a55c65405b827163ddaaad658 100644 (file)
@@ -34,6 +34,10 @@ def generate(map):
     """Generate a YAML mapfile content string.
     >>> generate({"q":"p"})
     'q: p\\n\\n'
+    >>> generate({"q":u"Fran\u00e7ais"})
+    'q: Fran\\xc3\\xa7ais\\n\\n'
+    >>> generate({"q":u"hello"})
+    'q: hello\\n\\n'
     >>> generate({"q=":"p"})
     Traceback (most recent call last):
     IllegalKey: Illegal key "q="
@@ -69,7 +73,9 @@ def generate(map):
 
     lines = []
     for key in keys:
-        lines.append(yaml.dump({key: map[key]}, default_flow_style=False))
+        lines.append(yaml.safe_dump({key: map[key]},
+                                    default_flow_style=False,
+                                    allow_unicode=True))
         lines.append("")
     return '\n'.join(lines)