summaryrefslogtreecommitdiff
path: root/gnowsys-ndf/gnowsys_ndf/ndf/views/file.py
diff options
context:
space:
mode:
Diffstat (limited to 'gnowsys-ndf/gnowsys_ndf/ndf/views/file.py')
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/views/file.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/views/file.py b/gnowsys-ndf/gnowsys_ndf/ndf/views/file.py
index aadce4f..b1c5d70 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/views/file.py
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/views/file.py
@@ -84,7 +84,6 @@ def file(request, group_id, file_id=None, page_no=1):
shelves = []
shelf_list = {}
auth = node_collection.one({'_type': 'Author', 'name': unicode(request.user.username) })
-
# if auth:
# has_shelf_RT = node_collection.one({'_type': 'RelationType', 'name': u'has_shelf' })
# dbref_has_shelf = has_shelf_RT.get_dbref()
@@ -679,6 +678,8 @@ def submitDoc(request, group_id):
group_name, group_id = get_group_name_id(group_id)
alreadyUploadedFiles = []
+ #a temp. variable which stores the lookup for append method
+ alreadyUploadedFiles_append_temp=alreadyUploadedFiles.append
str1 = ''
img_type=""
topic_file = ""
@@ -736,7 +737,7 @@ def submitDoc(request, group_id):
f = save_file(each,title,userid,group_id, content_org, tags, img_type, language, usrname, access_policy, license, source, Audience, fileType, subject, level, Based_url, request, map_geojson_data, oid=True)
if isinstance(f, list):
- alreadyUploadedFiles.append(f)
+ alreadyUploadedFiles_append_temp(f)
title = mtitle
# str1 = alreadyUploadedFiles
@@ -1311,16 +1312,19 @@ def file_detail(request, group_id, _id):
if auth:
has_shelf_RT = node_collection.one({'_type': 'RelationType', 'name': u'has_shelf' })
shelf = triple_collection.find({'_type': 'GRelation', 'subject': ObjectId(auth._id), 'relation_type.$id': has_shelf_RT._id })
-
+ #a temp. variable which stores the lookup for append method
+ shelves_append_temp=shelves.append
if shelf:
for each in shelf:
shelf_name = node_collection.one({'_id': ObjectId(each.right_subject)})
- shelves.append(shelf_name)
+ shelves_append_temp(shelf_name)
- shelf_list[shelf_name.name] = []
+ shelf_list[shelf_name.name] = []
+ #a temp. variable which stores the lookup for append method
+ shelf_list_shelfname_append_temp=shelf_list[shelf_name.name].append
for ID in shelf_name.collection_set:
shelf_item = node_collection.one({'_id': ObjectId(ID) })
- shelf_list[shelf_name.name].append(shelf_item.name)
+ shelf_list_shelfname_append_temp(shelf_item.name)
else:
shelves = []
@@ -1350,10 +1354,8 @@ def getFileThumbnail(request, group_id, _id):
auth = node_collection.one({'_type': 'Author', 'name': unicode(request.user.username) })
if group_ins:
group_id = str(group_ins._id)
- else:
- auth = node_collection.one({'_type': 'Author', 'name': unicode(request.user.username) })
- if auth:
- group_id = str(auth._id)
+ elif auth:
+ group_id = str(auth._id)
else:
pass