From 1087037d338033f5e624cd1019330fb590fb5f23 Mon Sep 17 00:00:00 2001 From: "A. Tapekhin" Date: Mon, 10 Oct 2016 18:12:49 +0300 Subject: [PATCH] fix to created_at --- docs/ver1_0.apib | 94 ++++++++++++------------- docs/ver2_0.apib | 94 ++++++++++++------------- lingvodoc/__init__.py | 61 ++++++++-------- lingvodoc/models.py | 17 ++--- lingvodoc/views/v2/blob.py | 4 +- lingvodoc/views/v2/convert/view.py | 2 +- lingvodoc/views/v2/dictionary.py | 14 ++-- lingvodoc/views/v2/lexical_entry.py | 12 ++-- lingvodoc/views/v2/perspective/views.py | 66 ++++++++--------- lingvodoc/views/v2/search.py | 2 +- lingvodoc/views/v2/user_and_login.py | 8 +++ lingvodoc/views/v2/utils.py | 2 +- 12 files changed, 194 insertions(+), 182 deletions(-) diff --git a/docs/ver1_0.apib b/docs/ver1_0.apib index c13338318..4a692fd04 100644 --- a/docs/ver1_0.apib +++ b/docs/ver1_0.apib @@ -290,14 +290,14 @@ Edits language. Only admins and user, who created language, can edit it. "object_id":1 } -## Perspective views [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}] +## Perspective views [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}] + Parameters + dictionary_client_id: 1 (number) - ID of the client, who created dictionary in the form of an integer + dictionary_object_id: 1 (number) - ID of the object in the form of an integer(dictionary) + perspective_client_id: 1 (number) - ID of the client, who created perspective in the form of an integer - + perspective_id: 1 (number) - ID of the object in the form of an integer(perspective) + + perspective_object_id: 1 (number) - ID of the object in the form of an integer(perspective) ### view [GET] @@ -357,7 +357,7 @@ Edits language. Only admins and user, who created language, can edit it. + Response 200 -## Perspective status [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/state] +## Perspective status [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/state] + Parameters @@ -365,7 +365,7 @@ Edits language. Only admins and user, who created language, can edit it. + dictionary_object_id: 1 (number) - ID of the object in the form of an integer(dictionary) + perspective_client_id: 1 (number) - ID of the client, who created perspective in the form of an integer - + perspective_id: 1 (number) - ID of the object in the form of an integer(perspective) + + perspective_object_id: 1 (number) - ID of the object in the form of an integer(perspective) ### view [GET] @@ -385,7 +385,7 @@ Edits language. Only admins and user, who created language, can edit it. + Response 200 -## Perspective tree [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/tree] +## Perspective tree [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/tree] + Parameters @@ -393,7 +393,7 @@ Edits language. Only admins and user, who created language, can edit it. + dictionary_object_id: 1 (number) - ID of the object in the form of an integer(dictionary) + perspective_client_id: 1 (number) - ID of the client, who created perspective in the form of an integer - + perspective_id: 1 (number) - ID of the object in the form of an integer(perspective) + + perspective_object_id: 1 (number) - ID of the object in the form of an integer(perspective) ### view [GET] @@ -493,7 +493,7 @@ Edits language. Only admins and user, who created language, can edit it. ] } -## Perspective meta [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/meta] +## Perspective meta [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/meta] + Parameters @@ -501,7 +501,7 @@ Edits language. Only admins and user, who created language, can edit it. + dictionary_object_id: 1 (number) - ID of the object in the form of an integer(dictionary) + perspective_client_id: 1 (number) - ID of the client, who created perspective in the form of an integer - + perspective_id: 1 (number) - ID of the object in the form of an integer(perspective) + + perspective_object_id: 1 (number) - ID of the object in the form of an integer(perspective) ### view [GET] @@ -688,7 +688,7 @@ Edits language. Only admins and user, who created language, can edit it. + Response 200 -## Perspective roles [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/roles] +## Perspective roles [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/roles] + Parameters @@ -696,7 +696,7 @@ Edits language. Only admins and user, who created language, can edit it. + dictionary_object_id: 1 (number) - ID of the object in the form of an integer(dictionary) + perspective_client_id: 1 (number) - ID of the client, who created perspective in the form of an integer - + perspective_id: 1 (number) - ID of the object in the form of an integer(perspective) + + perspective_object_id: 1 (number) - ID of the object in the form of an integer(perspective) ### view [GET] @@ -802,7 +802,7 @@ Edits language. Only admins and user, who created language, can edit it. + Response 200 -## Perspective fields [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/fields] +## Perspective fields [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/fields] + Parameters @@ -810,7 +810,7 @@ Edits language. Only admins and user, who created language, can edit it. + dictionary_object_id: 1 (number) - ID of the object in the form of an integer(dictionary) + perspective_client_id: 1 (number) - ID of the client, who created perspective in the form of an integer - + perspective_id: 1 (number) - ID of the object in the form of an integer(perspective) + + perspective_object_id: 1 (number) - ID of the object in the form of an integer(perspective) ### view [GET] @@ -1470,7 +1470,7 @@ Statistic on users, who contributed to this dictionary: how much of each entity } -## Perspective info [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/info] +## Perspective info [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/info] Statistic on users, who contributed to this perspective: how much of each entity type, created by them, were approved @@ -1664,13 +1664,13 @@ List of perspectives of this dictionary { } -## Create lexical entry [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/lexical_entry] +## Create lexical entry [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/lexical_entry] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer ### create [POST] @@ -1681,13 +1681,13 @@ List of perspectives of this dictionary "object_id":1234 } -## Create lexical entries [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/lexical_entries] +## Create lexical entries [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/lexical_entries] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer ### create [POST] @@ -1714,13 +1714,13 @@ List of perspectives of this dictionary } ] -## Create level one entity [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/lexical_entry/{lexical_entry_client_id}/{lexical_entry_object_id}/leveloneentity] +## Create level one entity [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/lexical_entry/{lexical_entry_client_id}/{lexical_entry_object_id}/leveloneentity] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer + lexical_entry_client_id: 1 (number) - ID of the client in the form of an integer + lexical_entry_object_id: 1 (number) - ID of the lexical entry in the form of an integer @@ -1742,13 +1742,13 @@ List of perspectives of this dictionary "object_id":1 } -## Create level two entity [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/lexical_entry/{lexical_entry_client_id}/{lexical_entry_object_id}/leveloneentity/{level_one_client_id}/{level_one_object_id}/leveltwoentity] +## Create level two entity [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/lexical_entry/{lexical_entry_client_id}/{lexical_entry_object_id}/leveloneentity/{level_one_client_id}/{level_one_object_id}/leveltwoentity] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer + lexical_entry_client_id: 1 (number) - ID of the client in the form of an integer + lexical_entry_object_id: 1 (number) - ID of the lexical entry in the form of an integer + level_one_client_id: 1 (number) - ID of the client in the form of an integer @@ -1772,13 +1772,13 @@ List of perspectives of this dictionary "object_id":1 } -## Create entities bulk [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/entities] +## Create entities bulk [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/entities] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer ### create [POST] @@ -2032,12 +2032,12 @@ List of perspectives of this dictionary } -## View lexical entry alternative [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/lexical_entry/{client_id}/{object_id}] +## View lexical entry alternative [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/lexical_entry/{client_id}/{object_id}] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer + client_id: 1 (number) - ID of the client in the form of an integer + object_id: 1 (number) - ID of the lexical entry in the form of an integer @@ -2235,13 +2235,13 @@ List of perspectives of this dictionary } -## Level one entity methods alternative [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/lexical_entry/{lexical_entry_client_id}/{lexical_entry_object_id}/leveloneentity/{client_id}/{object_id}] +## Level one entity methods alternative [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/lexical_entry/{lexical_entry_client_id}/{lexical_entry_object_id}/leveloneentity/{client_id}/{object_id}] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer + lexical_entry_client_id: 1 (number) - ID of the client in the form of an integer + lexical_entry_object_id: 1 (number) - ID of the lexical entry in the form of an integer + client_id: 1 (number) - ID of the client in the form of an integer @@ -2347,13 +2347,13 @@ List of perspectives of this dictionary { } -## Level two entity methods alternative [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/lexical_entry/{lexical_entry_client_id}/{lexical_entry_object_id}/leveloneentity/{leveloneentity_client_id}/{leveloneentity_object_id}/leveltwoentity/{client_id}/{object_id}] +## Level two entity methods alternative [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/lexical_entry/{lexical_entry_client_id}/{lexical_entry_object_id}/leveloneentity/{leveloneentity_client_id}/{leveloneentity_object_id}/leveltwoentity/{client_id}/{object_id}] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer + lexical_entry_client_id: 1 (number) - ID of the client in the form of an integer + lexical_entry_object_id: 1 (number) - ID of the lexical entry in the form of an integer + leveloneentity_client_id: 1 (number) - ID of the client in the form of an integer @@ -2422,12 +2422,12 @@ List of perspectives of this dictionary ] } -## Words connected by grouping entity alternative [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/lexical_entry/{client_id}/{object_id}/connected] +## Words connected by grouping entity alternative [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/lexical_entry/{client_id}/{object_id}/connected] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer + client_id: 1 (number) - ID of the client in the form of an integer + object_id: 1 (number) - ID of the lexical entry in the form of an integer @@ -2510,12 +2510,12 @@ List of perspectives of this dictionary { } -## Add word connection alternative [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/lexical_entry/{client_id}/{object_id}/connect] +## Add word connection alternative [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/lexical_entry/{client_id}/{object_id}/connect] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer + client_id: 1 (number) - ID of the client in the form of an integer + object_id: 1 (number) - ID of the lexical entry in the form of an integer @@ -2561,12 +2561,12 @@ List of perspectives of this dictionary { } -## Approve entities [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/approve] +## Approve entities [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/approve] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer ### Approve entities [PATCH] @@ -2625,12 +2625,12 @@ Disapproves bunch of entities, given their ids and types { } -## Approve all outer [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/approve_all_outer] +## Approve all outer [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/approve_all_outer] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer ### Approve all outer [PATCH] @@ -2639,12 +2639,12 @@ Approves all entities of perspective { } -## Approve all [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/approve_all] +## Approve all [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/approve_all] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer ### Approve all [PATCH] @@ -3539,13 +3539,13 @@ for every field in fields if new_type_name is specified, then all entities of ol ] -## All lexical entries [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/all{?sort_by,start_from,count}] +## All lexical entries [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/all{?sort_by,start_from,count}] + Parameters + dictionary_client_id: 1 (number) - ID of the client, who created dictionary in the form of an integer + dictionary_object_id: 1 (number) - ID of the object in the form of an integer(dictionary) + perspective_client_id: 1 (number) - ID of the client, who created perspective in the form of an integer - + perspective_id: 1 (number) - ID of the object in the form of an integer(perspective) + + perspective_object_id: 1 (number) - ID of the object in the form of an integer(perspective) + sort_by: "Word" (text)(optional) - by what column should be sorted + start_from: 0 (number) - where to start + count:200 (number) - how many to return @@ -4019,13 +4019,13 @@ for every field in fields if new_type_name is specified, then all entities of ol }] } -## All lexical entries count [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/all_count] +## All lexical entries count [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/all_count] + Parameters + dictionary_client_id: 1 (number) - ID of the client, who created dictionary in the form of an integer + dictionary_object_id: 1 (number) - ID of the object in the form of an integer(dictionary) + perspective_client_id: 1 (number) - ID of the client, who created perspective in the form of an integer - + perspective_id: 1 (number) - ID of the object in the form of an integer(perspective) + + perspective_object_id: 1 (number) - ID of the object in the form of an integer(perspective) ### view[GET] @@ -4037,13 +4037,13 @@ for every field in fields if new_type_name is specified, then all entities of ol } -## Published lexical entries [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/published{?sort_by,start_from,count}] +## Published lexical entries [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/published{?sort_by,start_from,count}] + Parameters + dictionary_client_id: 1 (number) - ID of the client, who created dictionary in the form of an integer + dictionary_object_id: 1 (number) - ID of the object in the form of an integer(dictionary) + perspective_client_id: 1 (number) - ID of the client, who created perspective in the form of an integer - + perspective_id: 1 (number) - ID of the object in the form of an integer(perspective) + + perspective_object_id: 1 (number) - ID of the object in the form of an integer(perspective) + sort_by: "Word" (text)(optional) - by what column should be sorted + start_from: 0 (number) - where to start + count:200 (number) - how many to return @@ -4319,13 +4319,13 @@ for every field in fields if new_type_name is specified, then all entities of ol } -## Published lexical entries count [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/published_count] +## Published lexical entries count [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/published_count] + Parameters + dictionary_client_id: 1 (number) - ID of the client, who created dictionary in the form of an integer + dictionary_object_id: 1 (number) - ID of the object in the form of an integer(dictionary) + perspective_client_id: 1 (number) - ID of the client, who created perspective in the form of an integer - + perspective_id: 1 (number) - ID of the object in the form of an integer(perspective) + + perspective_object_id: 1 (number) - ID of the object in the form of an integer(perspective) ### view[GET] diff --git a/docs/ver2_0.apib b/docs/ver2_0.apib index 4ad26d145..97b240df4 100644 --- a/docs/ver2_0.apib +++ b/docs/ver2_0.apib @@ -294,14 +294,14 @@ Edits language. Only admins and user, who created language, can edit it. "object_id":1 } -## Perspective views [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}] +## Perspective views [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}] + Parameters + dictionary_client_id: 1 (number) - ID of the client, who created dictionary in the form of an integer + dictionary_object_id: 1 (number) - ID of the object in the form of an integer(dictionary) + perspective_client_id: 1 (number) - ID of the client, who created perspective in the form of an integer - + perspective_id: 1 (number) - ID of the object in the form of an integer(perspective) + + perspective_object_id: 1 (number) - ID of the object in the form of an integer(perspective) ### view [GET] @@ -361,7 +361,7 @@ Edits language. Only admins and user, who created language, can edit it. + Response 200 -## Perspective status [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/state] +## Perspective status [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/state] + Parameters @@ -369,7 +369,7 @@ Edits language. Only admins and user, who created language, can edit it. + dictionary_object_id: 1 (number) - ID of the object in the form of an integer(dictionary) + perspective_client_id: 1 (number) - ID of the client, who created perspective in the form of an integer - + perspective_id: 1 (number) - ID of the object in the form of an integer(perspective) + + perspective_object_id: 1 (number) - ID of the object in the form of an integer(perspective) ### view [GET] @@ -389,7 +389,7 @@ Edits language. Only admins and user, who created language, can edit it. + Response 200 -## Perspective tree [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/tree] +## Perspective tree [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/tree] + Parameters @@ -397,7 +397,7 @@ Edits language. Only admins and user, who created language, can edit it. + dictionary_object_id: 1 (number) - ID of the object in the form of an integer(dictionary) + perspective_client_id: 1 (number) - ID of the client, who created perspective in the form of an integer - + perspective_id: 1 (number) - ID of the object in the form of an integer(perspective) + + perspective_object_id: 1 (number) - ID of the object in the form of an integer(perspective) ### view [GET] @@ -497,7 +497,7 @@ Edits language. Only admins and user, who created language, can edit it. ] } -## Perspective meta [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/meta] +## Perspective meta [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/meta] + Parameters @@ -505,7 +505,7 @@ Edits language. Only admins and user, who created language, can edit it. + dictionary_object_id: 1 (number) - ID of the object in the form of an integer(dictionary) + perspective_client_id: 1 (number) - ID of the client, who created perspective in the form of an integer - + perspective_id: 1 (number) - ID of the object in the form of an integer(perspective) + + perspective_object_id: 1 (number) - ID of the object in the form of an integer(perspective) ### view [GET] @@ -692,7 +692,7 @@ Edits language. Only admins and user, who created language, can edit it. + Response 200 -## Perspective roles [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/roles] +## Perspective roles [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/roles] + Parameters @@ -700,7 +700,7 @@ Edits language. Only admins and user, who created language, can edit it. + dictionary_object_id: 1 (number) - ID of the object in the form of an integer(dictionary) + perspective_client_id: 1 (number) - ID of the client, who created perspective in the form of an integer - + perspective_id: 1 (number) - ID of the object in the form of an integer(perspective) + + perspective_object_id: 1 (number) - ID of the object in the form of an integer(perspective) ### view [GET] @@ -806,7 +806,7 @@ Edits language. Only admins and user, who created language, can edit it. + Response 200 -## Perspective fields [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/fields] +## Perspective fields [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/fields] + Parameters @@ -814,7 +814,7 @@ Edits language. Only admins and user, who created language, can edit it. + dictionary_object_id: 1 (number) - ID of the object in the form of an integer(dictionary) + perspective_client_id: 1 (number) - ID of the client, who created perspective in the form of an integer - + perspective_id: 1 (number) - ID of the object in the form of an integer(perspective) + + perspective_object_id: 1 (number) - ID of the object in the form of an integer(perspective) ### view [GET] @@ -1467,7 +1467,7 @@ Statistic on users, who contributed to this dictionary: how much of each entity } -## Perspective info [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/info] +## Perspective info [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/info] Statistic on users, who contributed to this perspective: how much of each entity type, created by them, were approved @@ -1659,13 +1659,13 @@ List of perspectives of this dictionary { } -## Create lexical entry [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/lexical_entry] +## Create lexical entry [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/lexical_entry] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer ### create [POST] @@ -1676,13 +1676,13 @@ List of perspectives of this dictionary "object_id":1234 } -## Create lexical entries [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/lexical_entries] +## Create lexical entries [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/lexical_entries] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer ### create [POST] @@ -1709,13 +1709,13 @@ List of perspectives of this dictionary } ] -## Create level one entity [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/lexical_entry/{lexical_entry_client_id}/{lexical_entry_object_id}/leveloneentity] +## Create level one entity [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/lexical_entry/{lexical_entry_client_id}/{lexical_entry_object_id}/leveloneentity] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer + lexical_entry_client_id: 1 (number) - ID of the client in the form of an integer + lexical_entry_object_id: 1 (number) - ID of the lexical entry in the form of an integer @@ -1737,13 +1737,13 @@ List of perspectives of this dictionary "object_id":1 } -## Create level two entity [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/lexical_entry/{lexical_entry_client_id}/{lexical_entry_object_id}/leveloneentity/{level_one_client_id}/{level_one_object_id}/leveltwoentity] +## Create level two entity [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/lexical_entry/{lexical_entry_client_id}/{lexical_entry_object_id}/leveloneentity/{level_one_client_id}/{level_one_object_id}/leveltwoentity] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer + lexical_entry_client_id: 1 (number) - ID of the client in the form of an integer + lexical_entry_object_id: 1 (number) - ID of the lexical entry in the form of an integer + level_one_client_id: 1 (number) - ID of the client in the form of an integer @@ -1767,13 +1767,13 @@ List of perspectives of this dictionary "object_id":1 } -## Create entities bulk [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/entities] +## Create entities bulk [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/entities] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer ### create [POST] @@ -2025,12 +2025,12 @@ List of perspectives of this dictionary } -## View lexical entry alternative [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/lexical_entry/{client_id}/{object_id}] +## View lexical entry alternative [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/lexical_entry/{client_id}/{object_id}] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer + client_id: 1 (number) - ID of the client in the form of an integer + object_id: 1 (number) - ID of the lexical entry in the form of an integer @@ -2228,13 +2228,13 @@ List of perspectives of this dictionary } -## Level one entity methods alternative [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/lexical_entry/{lexical_entry_client_id}/{lexical_entry_object_id}/leveloneentity/{client_id}/{object_id}] +## Level one entity methods alternative [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/lexical_entry/{lexical_entry_client_id}/{lexical_entry_object_id}/leveloneentity/{client_id}/{object_id}] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer + lexical_entry_client_id: 1 (number) - ID of the client in the form of an integer + lexical_entry_object_id: 1 (number) - ID of the lexical entry in the form of an integer + client_id: 1 (number) - ID of the client in the form of an integer @@ -2340,13 +2340,13 @@ List of perspectives of this dictionary { } -## Level two entity methods alternative [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/lexical_entry/{lexical_entry_client_id}/{lexical_entry_object_id}/leveloneentity/{leveloneentity_client_id}/{leveloneentity_object_id}/leveltwoentity/{client_id}/{object_id}] +## Level two entity methods alternative [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/lexical_entry/{lexical_entry_client_id}/{lexical_entry_object_id}/leveloneentity/{leveloneentity_client_id}/{leveloneentity_object_id}/leveltwoentity/{client_id}/{object_id}] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer + lexical_entry_client_id: 1 (number) - ID of the client in the form of an integer + lexical_entry_object_id: 1 (number) - ID of the lexical entry in the form of an integer + leveloneentity_client_id: 1 (number) - ID of the client in the form of an integer @@ -2415,12 +2415,12 @@ List of perspectives of this dictionary ] } -## Words connected by grouping entity alternative [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/lexical_entry/{client_id}/{object_id}/connected] +## Words connected by grouping entity alternative [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/lexical_entry/{client_id}/{object_id}/connected] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer + client_id: 1 (number) - ID of the client in the form of an integer + object_id: 1 (number) - ID of the lexical entry in the form of an integer @@ -2503,12 +2503,12 @@ List of perspectives of this dictionary { } -## Add word connection alternative [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/lexical_entry/{client_id}/{object_id}/connect] +## Add word connection alternative [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/lexical_entry/{client_id}/{object_id}/connect] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer + client_id: 1 (number) - ID of the client in the form of an integer + object_id: 1 (number) - ID of the lexical entry in the form of an integer @@ -2554,12 +2554,12 @@ List of perspectives of this dictionary { } -## Approve entities [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/approve] +## Approve entities [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/approve] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer ### Approve entities [PATCH] @@ -2618,12 +2618,12 @@ Disapproves bunch of entities, given their ids and types { } -## Approve all outer [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/approve_all_outer] +## Approve all outer [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/approve_all_outer] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer ### Approve all outer [PATCH] @@ -2632,12 +2632,12 @@ Approves all entities of perspective { } -## Approve all [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/approve_all] +## Approve all [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/approve_all] + Parameters + dictionary_client_id: 1 (number) - ID of the client in the form of an integer + dictionary_object_id: 1 (number) - ID of the dictionary in the form of an integer + perspective_client_id: 1 (number) - ID of the client in the form of an integer - + perspective_id: 1 (number) - ID of the perspective in the form of an integer + + perspective_object_id: 1 (number) - ID of the perspective in the form of an integer ### Approve all [PATCH] @@ -3532,13 +3532,13 @@ for every field in fields if new_type_name is specified, then all entities of ol ] -## All lexical entries [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/all{?sort_by,start_from,count}] +## All lexical entries [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/all{?sort_by,start_from,count}] + Parameters + dictionary_client_id: 1 (number) - ID of the client, who created dictionary in the form of an integer + dictionary_object_id: 1 (number) - ID of the object in the form of an integer(dictionary) + perspective_client_id: 1 (number) - ID of the client, who created perspective in the form of an integer - + perspective_id: 1 (number) - ID of the object in the form of an integer(perspective) + + perspective_object_id: 1 (number) - ID of the object in the form of an integer(perspective) + sort_by: "Word" (text)(optional) - by what column should be sorted + start_from: 0 (number) - where to start + count:200 (number) - how many to return @@ -4010,13 +4010,13 @@ for every field in fields if new_type_name is specified, then all entities of ol "client_id": 10 }] -## All lexical entries count [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/all_count] +## All lexical entries count [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/all_count] + Parameters + dictionary_client_id: 1 (number) - ID of the client, who created dictionary in the form of an integer + dictionary_object_id: 1 (number) - ID of the object in the form of an integer(dictionary) + perspective_client_id: 1 (number) - ID of the client, who created perspective in the form of an integer - + perspective_id: 1 (number) - ID of the object in the form of an integer(perspective) + + perspective_object_id: 1 (number) - ID of the object in the form of an integer(perspective) ### view[GET] @@ -4028,13 +4028,13 @@ for every field in fields if new_type_name is specified, then all entities of ol } -## Published lexical entries [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/published{?sort_by,start_from,count}] +## Published lexical entries [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/published{?sort_by,start_from,count}] + Parameters + dictionary_client_id: 1 (number) - ID of the client, who created dictionary in the form of an integer + dictionary_object_id: 1 (number) - ID of the object in the form of an integer(dictionary) + perspective_client_id: 1 (number) - ID of the client, who created perspective in the form of an integer - + perspective_id: 1 (number) - ID of the object in the form of an integer(perspective) + + perspective_object_id: 1 (number) - ID of the object in the form of an integer(perspective) + sort_by: "Word" (text)(optional) - by what column should be sorted + start_from: 0 (number) - where to start + count:200 (number) - how many to return @@ -4308,13 +4308,13 @@ for every field in fields if new_type_name is specified, then all entities of ol ] -## Published lexical entries count [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_id}/published_count] +## Published lexical entries count [/dictionary/{dictionary_client_id}/{dictionary_object_id}/perspective/{perspective_client_id}/{perspective_object_id}/published_count] + Parameters + dictionary_client_id: 1 (number) - ID of the client, who created dictionary in the form of an integer + dictionary_object_id: 1 (number) - ID of the object in the form of an integer(dictionary) + perspective_client_id: 1 (number) - ID of the client, who created perspective in the form of an integer - + perspective_id: 1 (number) - ID of the object in the form of an integer(perspective) + + perspective_object_id: 1 (number) - ID of the object in the form of an integer(perspective) ### view[GET] diff --git a/lingvodoc/__init__.py b/lingvodoc/__init__.py index cd7804e27..a8019ecca 100755 --- a/lingvodoc/__init__.py +++ b/lingvodoc/__init__.py @@ -161,16 +161,16 @@ def configure_routes(config): # Future note: PUT & DELETE should work on-server only. config.add_route(name='perspective', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}/' - 'perspective/{perspective_client_id}/{perspective_id}', + 'perspective/{perspective_client_id}/{perspective_object_id}', factory='lingvodoc.models.ApproveAllAcl') # tested config.add_route(name='perspective_outside', - pattern='perspective/{perspective_client_id}/{perspective_id}', + pattern='perspective/{perspective_client_id}/{perspective_object_id}', factory='lingvodoc.models.ApproveAllAcl') # tested # API #POST # creates hash in metadata on objects config.add_route(name='perspective_hash', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}/' - 'perspective/{perspective_client_id}/{perspective_id}/hash', + 'perspective/{perspective_client_id}/{perspective_object_id}/hash', factory='lingvodoc.models.ApproveAllAcl') # TODO: ?test? only was used one time config.add_route(name='dangerous_perspectives_hash', @@ -189,22 +189,25 @@ def configure_routes(config): # } config.add_route(name='perspective_meta', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}/' - 'perspective/{perspective_client_id}/{perspective_id}/meta', + 'perspective/{perspective_client_id}/{perspective_object_id}/meta', factory='lingvodoc.models.ApproveAllAcl') # tested config.add_route(name='perspective_tree', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}/' - 'perspective/{perspective_client_id}/{perspective_id}/tree', + 'perspective/{perspective_client_id}/{perspective_object_id}/tree', factory='lingvodoc.models.ApproveAllAcl') # tested (?) config.add_route(name='perspective_outside_tree', - pattern='perspective/{perspective_client_id}/{perspective_id}/tree', + pattern='perspective/{perspective_client_id}/{perspective_object_id}/tree', factory='lingvodoc.models.ApproveAllAcl') # tested (?) config.add_route(name='perspective_info', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}/' - 'perspective/{perspective_client_id}/{perspective_id}/info', + 'perspective/{perspective_client_id}/{perspective_object_id}/info', factory='lingvodoc.models.ApproveAllAcl') + # config.add_route(name='test', + # pattern='/test', + # factory='lingvodoc.models.ApproveAllAcl') # tested # API #POST # Creating perspective config.add_route(name='create_perspective', @@ -229,14 +232,14 @@ def configure_routes(config): # roles and users that they are assigned. config.add_route(name='perspective_roles', pattern='/dictionary/{client_id}/{object_id}/' - 'perspective/{perspective_client_id}/{perspective_id}/roles', + 'perspective/{perspective_client_id}/{perspective_object_id}/roles', factory='lingvodoc.models.ApproveAllAcl') # API #GET && PUT # Get or change visibility state for perspective. States are: 'frozen', 'WiP', 'published' config.add_route(name='perspective_status', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}' - '/perspective/{perspective_client_id}/{perspective_id}/state', + '/perspective/{perspective_client_id}/{perspective_object_id}/state', factory='lingvodoc.models.ApproveAllAcl') # tested # API #GET && POST && DELETE @@ -262,7 +265,7 @@ def configure_routes(config): # status: }, contains: [{}], group: ] config.add_route(name='perspective_fields', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}' - '/perspective/{perspective_client_id}/{perspective_id}/fields', + '/perspective/{perspective_client_id}/{perspective_object_id}/fields', factory='lingvodoc.models.ApproveAllAcl') # tested (except delete, because it not used anywhere(?)) config.add_route(name='create_field', @@ -312,7 +315,7 @@ def configure_routes(config): config.add_route(name='get_entity_indict', pattern='/dictionary/' '{dictionary_client_id}/{dictionary_object_id}' '/perspective/' - '{perspective_client_id}/{perspective_id}/' + '{perspective_client_id}/{perspective_object_id}/' 'lexical_entry/' '{lexical_entry_client_id}/{lexical_entry_object_id}/' 'entity/' @@ -332,7 +335,7 @@ def configure_routes(config): config.add_route(name='get_connected_words_indict', pattern='/dictionary/' '{dictionary_client_id}/{dictionary_object_id}' '/perspective/' - '{perspective_client_id}/{perspective_id}/' + '{perspective_client_id}/{perspective_object_id}/' 'lexical_entry/' '{client_id}/{object_id}/' 'connected', @@ -345,7 +348,7 @@ def configure_routes(config): config.add_route(name='add_group_indict', pattern='/dictionary/' '{dictionary_client_id}/{dictionary_object_id}' '/perspective/' - '{perspective_client_id}/{perspective_id}/' + '{perspective_client_id}/{perspective_object_id}/' 'lexical_entry/' 'connect', factory='lingvodoc.models.ApproveAllAcl') # tested @@ -375,12 +378,12 @@ def configure_routes(config): # no parameters needed. # ids are returned. config.add_route(name='create_lexical_entry', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}' - '/perspective/{perspective_client_id}/{perspective_id}/' + '/perspective/{perspective_client_id}/{perspective_object_id}/' 'lexical_entry', factory='lingvodoc.models.ApproveAllAcl') # tested config.add_route(name='create_lexical_entry_bulk', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}' - '/perspective/{perspective_client_id}/{perspective_id}/' + '/perspective/{perspective_client_id}/{perspective_object_id}/' 'lexical_entries', factory='lingvodoc.models.ApproveAllAcl') # tested @@ -388,31 +391,31 @@ def configure_routes(config): # {'entity_type': , 'content': , 'locale_id': , 'metadata': } # ids are returned config.add_route(name='create_entity', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}' - '/perspective/{perspective_client_id}/{perspective_id}/' + '/perspective/{perspective_client_id}/{perspective_object_id}/' 'lexical_entry/{lexical_entry_client_id}/' '{lexical_entry_object_id}/entity', factory='lingvodoc.models.ApproveAllAcl') # tested config.add_route(name='create_entities_bulk', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}' - '/perspective/{perspective_client_id}/{perspective_id}/entities', + '/perspective/{perspective_client_id}/{perspective_object_id}/entities', factory='lingvodoc.models.ApproveAllAcl') # TODO: test # API #GET # params: start_from=M, count=N, sort_by= config.add_route(name='lexical_entries_all', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}' - '/perspective/{perspective_client_id}/{perspective_id}/all', + '/perspective/{perspective_client_id}/{perspective_object_id}/all', factory='lingvodoc.models.ApproveAllAcl') config.add_route(name='lexical_entries_all_count', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}' - '/perspective/{perspective_client_id}/{perspective_id}/all_count', + '/perspective/{perspective_client_id}/{perspective_object_id}/all_count', factory='lingvodoc.models.ApproveAllAcl') # tested config.add_route(name='lexical_entries_published', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}' - '/perspective/{perspective_client_id}/{perspective_id}/published', + '/perspective/{perspective_client_id}/{perspective_object_id}/published', factory='lingvodoc.models.ApproveAllAcl') config.add_route(name='lexical_entries_published_count', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}' - '/perspective/{perspective_client_id}/{perspective_id}/published_count', + '/perspective/{perspective_client_id}/{perspective_object_id}/published_count', factory='lingvodoc.models.ApproveAllAcl') # made only return list of ids, because another route fol full info exist @@ -421,7 +424,7 @@ def configure_routes(config): config.add_route(name='lexical_entry', pattern='/lexical_entry/{client_id}/{object_id}', factory='lingvodoc.models.ApproveAllAcl') # tested config.add_route(name='lexical_entry_in_perspective', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}' - '/perspective/{perspective_client_id}/{perspective_id}/' + '/perspective/{perspective_client_id}/{perspective_object_id}/' 'lexical_entry/{client_id}/{object_id}', factory='lingvodoc.models.ApproveAllAcl') # tested # API #PATCH @@ -429,26 +432,26 @@ def configure_routes(config): # "type": "leveloneentity", "leveltwoentity" # {"entity": [{"type": , "client_id": , "object_id": }, ] } config.add_route(name='approve_entity', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}' - '/perspective/{perspective_client_id}/{perspective_id}/approve', + '/perspective/{perspective_client_id}/{perspective_object_id}/approve', factory='lingvodoc.models.ApproveAllAcl') # todo: DANGEROUS! Anyone can approve, if the have their own dictionary and know ids of entity, they want to approve # todo: fix this config.add_route(name='approve_all', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}' - '/perspective/{perspective_client_id}/{perspective_id}/approve_all', + '/perspective/{perspective_client_id}/{perspective_object_id}/approve_all', factory='lingvodoc.models.ApproveAllAcl') config.add_route(name='approve_all_outer', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}' - '/perspective/{perspective_client_id}/{perspective_id}/approve_all_outer', + '/perspective/{perspective_client_id}/{perspective_object_id}/approve_all_outer', factory='lingvodoc.models.ApproveAllAcl') # TODO: test # web-view config.add_route(name='edit_dictionary', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}' - '/perspective/{perspective_client_id}/{perspective_id}/edit') + '/perspective/{perspective_client_id}/{perspective_object_id}/edit') # web-view config.add_route(name='view_dictionary', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}' - '/perspective/{perspective_client_id}/{perspective_id}/view') + '/perspective/{perspective_client_id}/{perspective_object_id}/view') # web-view config.add_route(name='publish_dictionary', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}' - '/perspective/{perspective_client_id}/{perspective_id}/publish') + '/perspective/{perspective_client_id}/{perspective_object_id}/publish') # Merge can be two kinds: # 1. Dictionaries merge @@ -550,7 +553,7 @@ def configure_routes(config): # [{"id": , "login": , "name": , "intl_name": , "userpic": }, ] config.add_route(name='dictionary_authors', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}') # TODO: do it config.add_route(name='perspective_authors', pattern='/dictionary/{dictionary_client_id}/{dictionary_object_id}' - '/perspective/{perspective_client_id}/{perspective_id}') # TODO: just do it + '/perspective/{perspective_client_id}/{perspective_object_id}') # TODO: just do it # API #GET # This methods gets info about user by his client_id diff --git a/lingvodoc/models.py b/lingvodoc/models.py index 1ee32529f..d2ceb0dd0 100755 --- a/lingvodoc/models.py +++ b/lingvodoc/models.py @@ -318,7 +318,7 @@ class CreatedAtMixin(object): """ It's used for automatically set created_at column. """ - created_at = Column(TIMESTAMP, default=datetime.datetime.utcnow().timestamp(), nullable=False) + created_at = Column(TIMESTAMP, default=datetime.datetime.utcnow(), nullable=False) class IdMixin(object): @@ -724,6 +724,7 @@ class PublishingEntity(Base, TableNameMixin, CreatedAtMixin): object_id = Column(SLBigInteger(), primary_key=True) client_id = Column(SLBigInteger(), primary_key=True) published = Column(Boolean, default=False, nullable=False) + # approved = Column(Boolean, default=False, nullable=False) parent = relationship('Entity', backref=backref("publishingentity", uselist=False)) @@ -921,7 +922,7 @@ def __acl__(self): pass object_id = None try: - object_id = self.request.matchdict['perspective_id'] + object_id = self.request.matchdict['perspective_object_id'] except: pass return acls + acl_by_groups(object_id, client_id, 'perspective') @@ -987,7 +988,7 @@ def __acl__(self): acls = [] object_id = None try: - object_id = self.request.matchdict['dictionary_perspective_id'] + object_id = self.request.matchdict['dictionary_perspective_object_id'] except: pass client_id = None @@ -1025,7 +1026,7 @@ def __acl__(self): acls = [] object_id = None try: - object_id = self.request.matchdict['perspective_id'] + object_id = self.request.matchdict['perspective_object_id'] except: pass client_id = None @@ -1044,7 +1045,7 @@ def __acl__(self): acls = [] object_id = None try: - object_id = self.request.matchdict['perspective_id'] + object_id = self.request.matchdict['perspective_object_id'] except: pass client_id = None @@ -1063,7 +1064,7 @@ def __acl__(self): acls = [] object_id = None try: - object_id = self.request.matchdict['perspective_id'] + object_id = self.request.matchdict['perspective_object_id'] except: pass client_id = None @@ -1145,7 +1146,7 @@ def __acl__(self): acls = [] object_id = None try: - object_id = self.request.matchdict['perspective_id'] + object_id = self.request.matchdict['perspective_object_id'] except: pass client_id = None @@ -1164,7 +1165,7 @@ def __acl__(self): acls = [] object_id = None try: - object_id = self.request.matchdict['perspective_id'] + object_id = self.request.matchdict['perspective_object_id'] except: pass client_id = None diff --git a/lingvodoc/views/v2/blob.py b/lingvodoc/views/v2/blob.py index 69844187e..f43c3e504 100644 --- a/lingvodoc/views/v2/blob.py +++ b/lingvodoc/views/v2/blob.py @@ -179,10 +179,10 @@ def blob_upload_get(request): dictionary_client_id = request.matchdict.get('dictionary_client_id') dictionary_object_id = request.matchdict.get('dictionary_object_id') perspective_client_id = request.matchdict.get('perspective_client_id') - perspective_id = request.matchdict.get('perspective_id') + perspective_object_id = request.matchdict.get('perspective_object_id') variables = {'client_id': client_id, 'user': user, 'dictionary_client_id': dictionary_client_id, 'dictionary_object_id': dictionary_object_id, 'perspective_client_id': perspective_client_id, - 'perspective_id': perspective_id} + 'perspective_object_id': perspective_object_id} return render_to_response('templates/user_upload.pt', variables, request=request) diff --git a/lingvodoc/views/v2/convert/view.py b/lingvodoc/views/v2/convert/view.py index 0b44dd7cb..8db0e9cd8 100644 --- a/lingvodoc/views/v2/convert/view.py +++ b/lingvodoc/views/v2/convert/view.py @@ -67,7 +67,7 @@ def convert_dictionary_check(request): # TODO: test dictionary_client_id=perspective.parent_client_id, dictionary_object_id=perspective.parent_object_id, perspective_client_id=perspective.client_id, - perspective_id=perspective.object_id) + perspective_object_id=perspective.object_id) subreq = Request.blank(path) subreq.method = 'GET' subreq.headers = request.headers diff --git a/lingvodoc/views/v2/dictionary.py b/lingvodoc/views/v2/dictionary.py index 6859abd5c..6f5ba7fe3 100644 --- a/lingvodoc/views/v2/dictionary.py +++ b/lingvodoc/views/v2/dictionary.py @@ -291,7 +291,7 @@ def copy_dictionary(request): dictionary_client_id=parent.client_id, dictionary_object_id=parent.object_id, perspective_client_id=perspective.client_id, - perspective_id=perspective.object_id) + perspective_object_id=perspective.object_id) subreq = Request.blank(path) subreq.method = 'GET' headers = {'Cookie': request.headers['Cookie']} @@ -302,7 +302,7 @@ def copy_dictionary(request): dictionary_client_id=new_dict.client_id, dictionary_object_id=new_dict.object_id, perspective_client_id=new_persp.client_id, - perspective_id=new_persp.object_id) + perspective_object_id=new_persp.object_id) subreq = Request.blank(path) subreq.method = 'POST' subreq.json = resp.json @@ -314,7 +314,7 @@ def copy_dictionary(request): dictionary_client_id=parent.client_id, dictionary_object_id=parent.object_id, perspective_client_id=perspective.client_id, - perspective_id=perspective.object_id) + perspective_object_id=perspective.object_id) subreq = Request.blank(path) subreq.method = 'GET' headers = {'Cookie': request.headers['Cookie']} @@ -325,7 +325,7 @@ def copy_dictionary(request): dictionary_client_id=new_dict.client_id, dictionary_object_id=new_dict.object_id, perspective_client_id=new_persp.client_id, - perspective_id=new_persp.object_id) + perspective_object_id=new_persp.object_id) subreq = Request.blank(path) subreq.method = 'PUT' subreq.json = resp.json @@ -337,7 +337,7 @@ def copy_dictionary(request): client_id=parent.client_id, object_id=parent.object_id, perspective_client_id=perspective.client_id, - perspective_id=perspective.object_id) + perspective_object_id=perspective.object_id) subreq = Request.blank(path) subreq.method = 'GET' headers = {'Cookie': request.headers['Cookie']} @@ -348,7 +348,7 @@ def copy_dictionary(request): client_id=new_dict.client_id, object_id=new_dict.object_id, perspective_client_id=new_persp.client_id, - perspective_id=new_persp.object_id) + perspective_object_id=new_persp.object_id) subreq = Request.blank(path) subreq.method = 'POST' subreq.json = resp.json @@ -491,7 +491,7 @@ def dictionary_info(request): # TODO: test dictionary_client_id=perspective.parent_client_id, dictionary_object_id=perspective.parent_object_id, perspective_client_id=perspective.client_id, - perspective_id=perspective.object_id + perspective_object_id=perspective.object_id ) subreq = Request.blank(path) subreq.method = 'GET' diff --git a/lingvodoc/views/v2/lexical_entry.py b/lingvodoc/views/v2/lexical_entry.py index 6dc4d8ee1..28c5835ce 100644 --- a/lingvodoc/views/v2/lexical_entry.py +++ b/lingvodoc/views/v2/lexical_entry.py @@ -187,7 +187,7 @@ def create_lexical_entry(request): # tested dictionary_client_id = request.matchdict.get('dictionary_client_id') dictionary_object_id = request.matchdict.get('dictionary_object_id') perspective_client_id = request.matchdict.get('perspective_client_id') - perspective_id = request.matchdict.get('perspective_id') + perspective_object_id = request.matchdict.get('perspective_object_id') variables = {'auth': request.authenticated_userid} client = DBSession.query(Client).filter_by(id=variables['auth']).first() @@ -198,13 +198,13 @@ def create_lexical_entry(request): # tested if not user: raise CommonException("This client id is orphaned. Try to logout and then login once more.") perspective = DBSession.query(DictionaryPerspective).\ - filter_by(client_id=perspective_client_id, object_id = perspective_id).first() + filter_by(client_id=perspective_client_id, object_id = perspective_object_id).first() if not perspective: request.response.status = HTTPNotFound.code return {'error': str("No such perspective in the system")} lexentr = LexicalEntry(object_id=DBSession.query(LexicalEntry).filter_by(client_id=client.id).count() + 1, client_id=variables['auth'], - parent_object_id=perspective_id, parent=perspective) + parent_object_id=perspective_object_id, parent=perspective) DBSession.add(lexentr) DBSession.flush() @@ -230,7 +230,7 @@ def create_lexical_entry_bulk(request): # TODO: test dictionary_client_id = request.matchdict.get('dictionary_client_id') dictionary_object_id = request.matchdict.get('dictionary_object_id') perspective_client_id = request.matchdict.get('perspective_client_id') - perspective_id = request.matchdict.get('perspective_id') + perspective_object_id = request.matchdict.get('perspective_object_id') count = request.json_body.get('count') or 0 @@ -244,7 +244,7 @@ def create_lexical_entry_bulk(request): # TODO: test if not user: raise CommonException("This client id is orphaned. Try to logout and then login once more.") perspective = DBSession.query(DictionaryPerspective). \ - filter_by(client_id=perspective_client_id, object_id = perspective_id).first() + filter_by(client_id=perspective_client_id, object_id = perspective_object_id).first() if not perspective: request.response.status = HTTPNotFound.code return {'error': str("No such perspective in the system")} @@ -252,7 +252,7 @@ def create_lexical_entry_bulk(request): # TODO: test lexes_list = [] for i in range(0, count): lexentr = LexicalEntry(object_id=DBSession.query(LexicalEntry).filter_by(client_id=client.id).count() + 1, client_id=variables['auth'], - parent_object_id=perspective_id, parent=perspective) + parent_object_id=perspective_object_id, parent=perspective) DBSession.add(lexentr) lexes_list.append(lexentr) DBSession.flush() diff --git a/lingvodoc/views/v2/perspective/views.py b/lingvodoc/views/v2/perspective/views.py index 9a5f33166..26cba3457 100644 --- a/lingvodoc/views/v2/perspective/views.py +++ b/lingvodoc/views/v2/perspective/views.py @@ -98,7 +98,7 @@ def perspectives_list(request): # tested @view_config(route_name='perspective_outside', renderer='json', request_method='GET') def view_perspective(request): # tested & in docs client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') parent_client_id = request.matchdict.get('dictionary_client_id') parent_object_id = request.matchdict.get('dictionary_object_id') parent = None @@ -124,7 +124,7 @@ def edit_perspective_hash(request): try: response = dict() client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') client = DBSession.query(Client).filter_by(id=request.authenticated_userid).first() if not client: raise KeyError("Invalid client id (not registered on server). Try to logout and then login.") @@ -213,7 +213,7 @@ def dangerous_perspectives_hash(request): # TODO: test? dictionary_client_id=perspective.parent_client_id, dictionary_object_id=perspective.parent_object_id, perspective_client_id=perspective.client_id, - perspective_id=perspective.object_id) + perspective_object_id=perspective.object_id) subreq = Request.blank(path) subreq.method = 'PUT' subreq.headers = request.headers @@ -227,7 +227,7 @@ def dangerous_perspectives_hash(request): # TODO: test? def edit_perspective_meta(request): # tested & in docs response = dict() client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') client = DBSession.query(Client).filter_by(id=request.authenticated_userid).first() if not client: raise KeyError("Invalid client id (not registered on server). Try to logout and then login.") @@ -266,7 +266,7 @@ def edit_perspective_meta(request): # tested & in docs def delete_perspective_meta(request): # tested & in docs response = dict() client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') client = DBSession.query(Client).filter_by(id=request.authenticated_userid).first() if not client: raise KeyError("Invalid client id (not registered on server). Try to logout and then login.") @@ -304,7 +304,7 @@ def delete_perspective_meta(request): # tested & in docs def view_perspective_meta(request): # tested & in docs response = dict() client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') parent_client_id = request.matchdict.get('dictionary_client_id') parent_object_id = request.matchdict.get('dictionary_object_id') parent = DBSession.query(Dictionary).filter_by(client_id=parent_client_id, object_id=parent_object_id).first() @@ -356,7 +356,7 @@ def view_perspective_meta(request): # tested & in docs def view_perspective_tree(request): # tested & in docs response = dict() client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') parent_client_id = request.matchdict.get('dictionary_client_id') parent_object_id = request.matchdict.get('dictionary_object_id') parent = None @@ -413,7 +413,7 @@ def view_perspective_tree(request): # tested & in docs def perspective_info(request): # TODO: test response = dict() client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') parent_client_id = request.matchdict.get('dictionary_client_id') parent_object_id = request.matchdict.get('dictionary_object_id') starting_date = request.GET.get('starting_date') @@ -443,7 +443,7 @@ def perspective_info(request): # TODO: test dictionary_client_id=perspective.parent_client_id, dictionary_object_id=perspective.parent_object_id, perspective_client_id=perspective.client_id, - perspective_id=perspective.object_id + perspective_object_id=perspective.object_id ) subreq = Request.blank(path) subreq.method = 'GET' @@ -611,7 +611,7 @@ def complex_create(request): dictionary_client_id=parent_client_id, dictionary_object_id=parent_object_id, perspective_client_id=perspective_json['client_id'], - perspective_id=perspective_json['object_id']) + perspective_object_id=perspective_json['object_id']) subreq = Request.blank(path) subreq.method = 'PUT' subreq.headers = request.headers @@ -678,7 +678,7 @@ def view_perspectives(request): dictionary_client_id=parent_client_id, dictionary_object_id=parent_object_id, perspective_client_id=perspective.client_id, - perspective_id=perspective.object_id) + perspective_object_id=perspective.object_id) subreq = Request.blank(path) subreq.method = 'GET' subreq.headers = request.headers @@ -701,7 +701,7 @@ def view_perspectives(request): def view_perspective_roles(request): # TODO: test response = dict() client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') parent_client_id = request.matchdict.get('client_id') parent_object_id = request.matchdict.get('object_id') parent = DBSession.query(Dictionary).filter_by(client_id=parent_client_id, object_id=parent_object_id).first() @@ -743,7 +743,7 @@ def view_perspective_roles(request): # TODO: test def edit_perspective_roles(request): response = dict() client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') parent_client_id = request.matchdict.get('client_id') parent_object_id = request.matchdict.get('object_id') @@ -845,7 +845,7 @@ def edit_perspective_roles(request): def delete_perspective_roles(request): # TODO: test response = dict() client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') parent_client_id = request.matchdict.get('client_id') parent_object_id = request.matchdict.get('object_id') req = request.json_body @@ -946,7 +946,7 @@ def delete_perspective_roles(request): # TODO: test def view_perspective_status(request): # tested & in docs response = dict() client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') parent_client_id = request.matchdict.get('dictionary_client_id') parent_object_id = request.matchdict.get('dictionary_object_id') parent = DBSession.query(Dictionary).filter_by(client_id=parent_client_id, object_id=parent_object_id).first() @@ -975,7 +975,7 @@ def view_perspective_status(request): # tested & in docs def edit_perspective_status(request): # tested & in docs response = dict() client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') parent_client_id = request.matchdict.get('dictionary_client_id') parent_object_id = request.matchdict.get('dictionary_object_id') parent = DBSession.query(Dictionary).filter_by(client_id=parent_client_id, object_id=parent_object_id).first() @@ -1129,7 +1129,7 @@ def view_nested_field(request, field, link_ids): def view_perspective_fields(request): response = list() client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') perspective = DBSession.query(DictionaryPerspective).filter_by(client_id=client_id, object_id=object_id).first() if perspective and not perspective.marked_for_deletion: fields = DBSession.query(DictionaryPerspectiveToField)\ @@ -1159,7 +1159,7 @@ def view_perspective_fields(request): def update_perspective_fields(request): response = dict() client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') perspective = DBSession.query(DictionaryPerspective).filter_by(client_id=client_id, object_id=object_id).first() variables = {'auth': authenticated_userid(request)} client = DBSession.query(Client).filter_by(id=variables['auth']).first() @@ -1214,7 +1214,7 @@ def update_perspective_fields(request): def lexical_entries_all(request): response = dict() client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') sort_criterion = request.params.get('sort_by') or 'Translation' start_from = request.params.get('start_from') or 0 @@ -1257,7 +1257,7 @@ def lexical_entries_all(request): def lexical_entries_all_count(request): # tested response = dict() client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') sort_criterion = request.params.get('sort_by') or 'Translation' start_from = request.params.get('start_from') or 0 @@ -1281,7 +1281,7 @@ def lexical_entries_all_count(request): # tested def lexical_entries_published(request): response = dict() client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') sort_criterion = request.params.get('sort_by') or 'Translation' start_from = request.params.get('start_from') or 0 @@ -1333,7 +1333,7 @@ def lexical_entries_published(request): @view_config(route_name='lexical_entries_published_count', renderer='json', request_method='GET', permission='view') def lexical_entries_published_count(request): client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') parent = DBSession.query(DictionaryPerspective).filter_by(client_id=client_id, object_id=object_id).first() if parent: @@ -1431,7 +1431,7 @@ def disapprove_entity(request): def approve_all(request): response = dict() client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') parent = DBSession.query(DictionaryPerspective).filter_by(client_id=client_id, object_id=object_id).first() if parent: @@ -1444,7 +1444,7 @@ def approve_all(request): dictionary_client_id=dictionary_client_id, dictionary_object_id=dictionary_object_id, perspective_client_id=client_id, - perspective_id=object_id) + perspective_object_id=object_id) subreq = Request.blank(url) jsn = entities subreq.json = jsn @@ -1463,7 +1463,7 @@ def approve_all(request): def approve_outer(request): # TODO: create test. from lingvodoc.scripts.approve import approve_all_outer client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') cli_id = request.matchdict.get('dictionary_client_id') obj_id = request.matchdict.get('dictionary_object_id') @@ -1500,11 +1500,11 @@ def edit_dictionary_get(request): dictionary_client_id = request.matchdict.get('dictionary_client_id') dictionary_object_id = request.matchdict.get('dictionary_object_id') perspective_client_id = request.matchdict.get('perspective_client_id') - perspective_id = request.matchdict.get('perspective_id') + perspective_object_id = request.matchdict.get('perspective_object_id') variables = {'client_id': client_id, 'user': user, 'dictionary_client_id': dictionary_client_id, 'dictionary_object_id': dictionary_object_id, 'perspective_client_id': perspective_client_id, - 'perspective_id': perspective_id} + 'perspective_object_id': perspective_object_id} return render_to_response('../templates/edit_dictionary.pt', variables, request=request) @@ -1517,11 +1517,11 @@ def view_dictionary_get(request): dictionary_client_id = request.matchdict.get('dictionary_client_id') dictionary_object_id = request.matchdict.get('dictionary_object_id') perspective_client_id = request.matchdict.get('perspective_client_id') - perspective_id = request.matchdict.get('perspective_id') + perspective_object_id = request.matchdict.get('perspective_object_id') variables = {'user': user, 'dictionary_client_id': dictionary_client_id, 'dictionary_object_id': dictionary_object_id, 'perspective_client_id': perspective_client_id, - 'perspective_id': perspective_id} + 'perspective_object_id': perspective_object_id} return render_to_response('../templates/view_dictionary.pt', variables, request=request) @@ -1537,11 +1537,11 @@ def publish_dictionary_get(request): dictionary_client_id = request.matchdict.get('dictionary_client_id') dictionary_object_id = request.matchdict.get('dictionary_object_id') perspective_client_id = request.matchdict.get('perspective_client_id') - perspective_id = request.matchdict.get('perspective_id') + perspective_object_id = request.matchdict.get('perspective_object_id') variables = {'client_id': client_id, 'user': user, 'dictionary_client_id': dictionary_client_id, 'dictionary_object_id': dictionary_object_id, 'perspective_client_id': perspective_client_id, - 'perspective_id': perspective_id} + 'perspective_object_id': perspective_object_id} return render_to_response('../templates/publish_dictionary.pt', variables, request=request) @@ -1641,7 +1641,7 @@ def edit_perspective(request): # tested & in docs try: response = dict() client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') client = DBSession.query(Client).filter_by(id=request.authenticated_userid).first() if not client: raise KeyError("Invalid client id (not registered on server). Try to logout and then login.") @@ -1687,7 +1687,7 @@ def edit_perspective(request): # tested & in docs def delete_perspective(request): # tested & in docs response = dict() client_id = request.matchdict.get('perspective_client_id') - object_id = request.matchdict.get('perspective_id') + object_id = request.matchdict.get('perspective_object_id') parent_client_id = request.matchdict.get('dictionary_client_id') parent_object_id = request.matchdict.get('dictionary_object_id') parent = DBSession.query(Dictionary).filter_by(client_id=parent_client_id, object_id=parent_object_id).first() diff --git a/lingvodoc/views/v2/search.py b/lingvodoc/views/v2/search.py index b03fc2728..5f7ec976e 100644 --- a/lingvodoc/views/v2/search.py +++ b/lingvodoc/views/v2/search.py @@ -88,7 +88,7 @@ def basic_search(request): dictionary_client_id=entry.parent.parent.client_id, dictionary_object_id=entry.parent.parent.object_id, perspective_client_id=entry.parent_client_id, - perspective_id=entry.parent_object_id) + perspective_object_id=entry.parent_object_id) subreq = Request.blank(url) subreq.method = 'GET' headers = {'Cookie': request.headers['Cookie']} diff --git a/lingvodoc/views/v2/user_and_login.py b/lingvodoc/views/v2/user_and_login.py index 85597a945..4eb9cd461 100644 --- a/lingvodoc/views/v2/user_and_login.py +++ b/lingvodoc/views/v2/user_and_login.py @@ -177,6 +177,14 @@ def signin(request): return HTTPUnauthorized(location=request.route_url('login')) +# @view_config(route_name='test', renderer='json', request_method='GET') +# def test(request): +# client = Client(user_id=1, counter = 2147483647123) +# DBSession.add(client) +# DBSession.flush() +# return {} + + @view_config(route_name='cheatlogin', request_method='POST', renderer='json') def login_cheat(request): # TODO: test next = request.params.get('next') or request.route_url('dashboard') diff --git a/lingvodoc/views/v2/utils.py b/lingvodoc/views/v2/utils.py index 04be47d22..c4b42508a 100644 --- a/lingvodoc/views/v2/utils.py +++ b/lingvodoc/views/v2/utils.py @@ -283,7 +283,7 @@ def participated_clients_list(dictionary, request): dictionary_client_id = dictionary.client_id, dictionary_object_id = dictionary.object_id, perspective_client_id = persp.client_id, - perspective_id = persp.object_id) + perspective_object_id = persp.object_id) subreq = Request.blank(path) subreq.method = 'GET' subreq.headers = request.headers