зеркало из https://github.com/mozilla/frappe.git
FIx #28. When user don't exist, it will create one with that external_id.
This commit is contained in:
Родитель
8af805eae9
Коммит
1c6aca6add
|
@ -198,7 +198,11 @@ class IController(object):
|
|||
:param n:
|
||||
:return: Item external id list
|
||||
"""
|
||||
user = User.get_user_by_external_id(user)
|
||||
try:
|
||||
user = User.get_user_by_external_id(user)
|
||||
except IndexError:
|
||||
logging.info("User %s not exist. Is going to be created")
|
||||
user = User.objects.create(external_id=user)
|
||||
result = self.get_recommendation(user=user, n=n)
|
||||
return [Item.get_item_external_id_by_id(r) for r in result]
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче