Skip to content

Commit cef549c

Browse files
author
limodou
committed
Fix get_collection_name() bug
git-svn-id: https://uliweb.googlecode.com/svn/trunk@1037 14287918-b64d-0410-abb6-a92efa0c2026
1 parent d41bf6e commit cef549c

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Uliweb Change Log
3333
* Fix template.py for multiple times extending the same template file bug
3434
* Expose `filename_convert()` function from upload app
3535
* Add `get_uuid()` function to utils/common.py
36+
* Fix `get_collection_name()` bug
3637
3738
0.1.5 Version
3839
-----------------

‎uliweb/orm/__init__.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2426,8 +2426,8 @@ def get_collection_name(cls, collection_name=None, prefix=None):
24262426
if hasattr(cls, collection_name):
24272427
#if the xxx_set is already existed, then automatically
24282428
#create unique collection_set id
2429-
collection_name = prefix + '_set_' + str(__collection_set_id__)
2430-
self.__class__.__collection_set_id__ += 1
2429+
collection_name = prefix + '_set_' + str(cls.__collection_set_id__)
2430+
cls.__collection_set_id__ += 1
24312431
else:
24322432
if hasattr(cls, collection_name):
24332433
raise DuplicatePropertyError("Model %s already has property %s" % (cls.__name__, collection_name))

‎uliweb/utils/generic.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from uliweb.core.storage import Storage
1111
from sqlalchemy.sql import Select
1212
from uliweb.contrib.upload import FileServing, FilenameConverter
13+
from uliweb.utils.common import safe_unicode, safe_str
1314

1415
__default_fields_builds__ = {}
1516
class __default_value__(object):pass
@@ -328,7 +329,7 @@ def get_obj_url(obj):
328329
def to_json_result(success, msg='', d=None, json_func=None, **kwargs):
329330
json_func = json_func or json
330331

331-
t = {'success':success, 'message':str(msg), 'data':d}
332+
t = {'success':success, 'message':safe_str(msg), 'data':d}
332333
t.update(kwargs)
333334
return json_func(t)
334335

@@ -1452,7 +1453,6 @@ def download(self, filename, timeout=3600, action=None, query=None, fields_conve
14521453
return self.download_csv(filename, query, table, action, fields_convert_map, not_tempfile=bool(timeout))
14531454

14541455
def get_data(self, query, table, fields_convert_map, encoding='utf-8', plain=True):
1455-
from uliweb.utils.common import safe_unicode
14561456
from uliweb.orm import do_
14571457

14581458
fields_convert_map = fields_convert_map or {}

0 commit comments

Comments
 (0)