标签:meta png 步骤 tip tor 技术 color 异常 packages
表现:界面上报错:,刚登陆进去就能看到,点击执行也会出现。日志里报:
Traceback (most recent call last): File "/home/work/hue-3.10.0/desktop/libs/notebook/src/notebook/decorators.py", line 81, in decorator return func(*args, **kwargs) File "/home/work/hue-3.10.0/desktop/libs/notebook/src/notebook/api.py", line 124, in execute history = _historify(notebook, request.user) File "/home/work/hue-3.10.0/desktop/libs/notebook/src/notebook/api.py", line 319, in _historify is_history=True File "/home/work/hue-3.10.0/build/env/local/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/manager.py", line 157, in create return self.get_queryset().create(**kwargs) File "/home/work/hue-3.10.0/build/env/local/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/query.py", line 322, in create obj.save(force_insert=True, using=self.db) File "/home/work/hue-3.10.0/desktop/core/src/desktop/models.py", line 1138, in save home_dir = Document2.objects.get_home_directory(self.owner) File "/home/work/hue-3.10.0/desktop/core/src/desktop/models.py", line 935, in get_home_directory return self.get(owner=user, parent_directory=None, name=Document2.HOME_DIR, type=‘directory‘) File "/home/work/hue-3.10.0/build/env/local/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/manager.py", line 151, in get return self.get_queryset().get(*args, **kwargs) File "/home/work/hue-3.10.0/build/env/local/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/query.py", line 313, in get (self.model._meta.object_name, num)) MultipleObjectsReturned: get() returned more than one Document2 -- it returned 2!
复现步骤:已账号xxxx登录hue,即可看到异常.
ps: 有人在官网报此问题,http://gethue.com/how-to-fix-the-multipleobjectsreturned-error-in-hue/ 但官方没有给出解决方法.
def get_home_directory(self, user): try: return self.get(owner=user, parent_directory=None, name=Document2.HOME_DIR, type=‘directory‘) except Document2.DoesNotExist: return self.create_user_directories(user)
是class Document2Manager的方法,怀疑是用户表中存的用户记录多了一条,所以查到两个home directory,查了auth_user表和useradmin_userprofile表,都正常。后又查表desktop_document2,按self.get()中的查询条件果然查到两行:
解决HUE报错MultipleObjectsReturned: get() returned more than one Document2 -- it returned 2!
标签:meta png 步骤 tip tor 技术 color 异常 packages
原文地址:http://www.cnblogs.com/aprilrain/p/6950842.html