aboutsummaryrefslogtreecommitdiffstats
path: root/libbe
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2008-12-04 10:32:10 -0500
committerW. Trevor King <wking@drexel.edu>2008-12-04 10:32:10 -0500
commitd1dfc45b051b0e14c0e2d7ed6dbf1d32927d7bfb (patch)
tree7d236d73762bbc654ae6f864b576b802e68b9a4b /libbe
parentca347e86bef7bbdd0d1007beaf283f29ec1bbdff (diff)
downloadbugseverywhere-d1dfc45b051b0e14c0e2d7ed6dbf1d32927d7bfb.tar.gz
bug severity verification now works with per-tree severities.
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.
Diffstat (limited to 'libbe')
-rw-r--r--libbe/bug.py6
-rw-r--r--libbe/mapfile.py8
2 files changed, 8 insertions, 6 deletions
diff --git a/libbe/bug.py b/libbe/bug.py
index 46f244f..2cd05e3 100644
--- a/libbe/bug.py
+++ b/libbe/bug.py
@@ -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 {}
diff --git a/libbe/mapfile.py b/libbe/mapfile.py
index a84cca3..f53f72c 100644
--- a/libbe/mapfile.py
+++ b/libbe/mapfile.py
@@ -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)