get[section], fixes #1834

This commit is contained in:
j 2013-08-26 17:05:49 +00:00
parent 95d87ef382
commit e1760e7b50
4 changed files with 29 additions and 2 deletions

View file

@ -204,8 +204,8 @@ def getEdit(request):
'''
data = json.loads(request.POST['data'])
if 'id' in data:
edit = get_edit_or_404_json(data['id'])
response = json_response()
edit = get_edit_or_404_json(data['id'])
if edit.accessible(request.user):
response['data'] = edit.json(user=request.user)
else:

View file

@ -119,6 +119,30 @@ def findLists(request):
return render_to_json_response(response)
actions.register(findLists)
def getList(request):
'''
takes {
id: listid
}
returns {
id:
section:
...
}
'''
data = json.loads(request.POST['data'])
if 'id' in data:
response = json_response()
list = get_list_or_404_json(data['id'])
if list.accessible(request.user):
response['data'] = list.json(user=request.user)
else:
response = json_response(status=403, text='not allowed')
else:
response = json_response(status=404, text='not found')
return render_to_json_response(response)
actions.register(getList)
@login_required_json
def addListItems(request):
'''

View file

@ -97,6 +97,9 @@ def getText(request):
text = qs[0]
else:
text = get_text_or_404_json(data['id'])
if not text.accessible(request.user):
text = None
response['status']['code'] = 404
if text:
response['data'] = text.json(user=request.user)
return render_to_json_response(response)

View file

@ -2017,7 +2017,7 @@ pandora.selectList = function() {
var id = pandora.user.ui[pandora.user.ui.section.slice(0,-1)],
section = Ox.toTitleCase(pandora.user.ui.section.slice(0, -1));
if (id) {
pandora.api['edit' + section]({id: id}, function(result) {
pandora.api['get' + section]({id: id}, function(result) {
var folder;
if (result.data.id) {
folder = result.data.status == 'featured' ? 'featured' : (