Show More
@@ -25,6 +25,7 b' from sqlalchemy import UnicodeText' | |||||
25 | from sqlalchemy.ext.mutable import Mutable |
|
25 | from sqlalchemy.ext.mutable import Mutable | |
26 |
|
26 | |||
27 | from rhodecode.lib.ext_json import json |
|
27 | from rhodecode.lib.ext_json import json | |
|
28 | from rhodecode.lib.utils2 import safe_unicode | |||
28 |
|
29 | |||
29 |
|
30 | |||
30 | class JsonRaw(unicode): |
|
31 | class JsonRaw(unicode): | |
@@ -56,10 +57,12 b' class JSONEncodedObj(sqlalchemy.types.Ty' | |||||
56 |
|
57 | |||
57 | impl = UnicodeText |
|
58 | impl = UnicodeText | |
58 | safe = True |
|
59 | safe = True | |
|
60 | enforce_unicode = True | |||
59 |
|
61 | |||
60 | def __init__(self, *args, **kwargs): |
|
62 | def __init__(self, *args, **kwargs): | |
61 | self.default = kwargs.pop('default', None) |
|
63 | self.default = kwargs.pop('default', None) | |
62 | self.safe = kwargs.pop('safe_json', self.safe) |
|
64 | self.safe = kwargs.pop('safe_json', self.safe) | |
|
65 | self.enforce_unicode = kwargs.pop('enforce_unicode', self.enforce_unicode) | |||
63 | self.dialect_map = kwargs.pop('dialect_map', {}) |
|
66 | self.dialect_map = kwargs.pop('dialect_map', {}) | |
64 | super(JSONEncodedObj, self).__init__(*args, **kwargs) |
|
67 | super(JSONEncodedObj, self).__init__(*args, **kwargs) | |
65 |
|
68 | |||
@@ -73,6 +76,8 b' class JSONEncodedObj(sqlalchemy.types.Ty' | |||||
73 | value = value |
|
76 | value = value | |
74 | elif value is not None: |
|
77 | elif value is not None: | |
75 | value = json.dumps(value) |
|
78 | value = json.dumps(value) | |
|
79 | if self.enforce_unicode: | |||
|
80 | value = safe_unicode(value) | |||
76 | return value |
|
81 | return value | |
77 |
|
82 | |||
78 | def process_result_value(self, value, dialect): |
|
83 | def process_result_value(self, value, dialect): |
@@ -3956,7 +3956,7 b' class _PullRequestBase(BaseModel):' | |||||
3956 |
|
3956 | |||
3957 | @revisions.setter |
|
3957 | @revisions.setter | |
3958 | def revisions(self, val): |
|
3958 | def revisions(self, val): | |
3959 | self._revisions = ':'.join(val) |
|
3959 | self._revisions = u':'.join(val) | |
3960 |
|
3960 | |||
3961 | @hybrid_property |
|
3961 | @hybrid_property | |
3962 | def last_merge_status(self): |
|
3962 | def last_merge_status(self): |
General Comments 0
You need to be logged in to leave comments.
Login now