Commit 384b32c2 authored by saurabh's avatar saurabh

Replace with get_group_name_id wherever needed in the views

parent 6963f8f0
......@@ -23,18 +23,23 @@ def custom_app_view(request, group_id, app_name, app_id=None, app_set_id=None, a
"""
custom view for custom GAPPS
"""
ins_objectid = ObjectId()
if ins_objectid.is_valid(group_id) is False :
group_ins = node_collection.find_one({'_type': "Group","name": group_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)
else :
pass
#ins_objectid = ObjectId()
#if ins_objectid.is_valid(group_id) is False :
#group_ins = node_collection.find_one({'_type': "Group","name": group_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)
#else :
#pass
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
if app_id is None:
if app_name == "partners":
app_name = "Partners"
......@@ -172,18 +177,26 @@ def custom_app_new_view(request, group_id, app_name, app_id, app_set_id=None, ap
"""
create new instance of app_set of apps view for custom GAPPS
"""
ins_objectid = ObjectId()
if ins_objectid.is_valid(group_id) is False :
group_ins = node_collection.find_one({'_type': "Group","name": group_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)
else :
pass
# ins_objectid = ObjectId()
# if ins_objectid.is_valid(group_id) is False :
# group_ins = node_collection.find_one({'_type': "Group","name": group_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)
# else :
# pass
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
if app_id is None:
app_ins = node_collection.find_one({'_type':"GSystemType", "name":app_name})
if app_ins:
......
......@@ -29,8 +29,13 @@ app = node_collection.one({'_type':'GSystemType', 'name': 'E-Library'})
@get_execution_time
def ebook_listing(request, group_id, page_no=1):
group_name, group_id = get_group_name_id(group_id)
# group_name, group_id = get_group_name_id(group_id)
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
all_ebooks = node_collection.find({"_type": "File", "attribute_set.educationaluse": "eBooks"})
# all_ebook = node_collection.find({"_type": "File", "member_of": {"$in":[gst_ebook._id]} })
......
......@@ -37,7 +37,11 @@ def resource_list(request, group_id, app_id=None, page_no=1):
is_video = request.GET.get('is_video', "")
group_name, group_id = get_group_name_id(group_id)
# group_name, group_id = get_group_name_id(group_id)
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
if app_id is None:
app_id = str(app._id)
......
......@@ -43,6 +43,7 @@ def event(request, group_id):
group_id = str(auth._id)
else :
pass
#view written just to show the landing page of the events
group_inverse_rel_id = []
Event_app = True
......@@ -101,17 +102,21 @@ def event_detail(request, group_id, app_id=None, app_set_id=None, app_set_instan
View for handling Event and it's sub-types detail-view
"""
auth = None
if ObjectId.is_valid(group_id) is False :
group_ins = node_collection.one({'_type': "Group","name": group_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)
else :
pass
# if ObjectId.is_valid(group_id) is False :
# group_ins = node_collection.one({'_type': "Group","name": group_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)
# else :
# pass
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
session_node = ""
app = None
session_node = ""
......@@ -306,17 +311,21 @@ def event_create_edit(request, group_id, app_set_id=None, app_set_instance_id=No
View for handling Event and it's sub-types create-edit-view
"""
auth = None
if ObjectId.is_valid(group_id) is False :
group_ins = node_collection.one({'_type': "Group","name": group_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)
else :
pass
# if ObjectId.is_valid(group_id) is False :
# group_ins = node_collection.one({'_type': "Group","name": group_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)
# else :
# pass
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
'''
app = None
if app_id is None:
......
......@@ -65,17 +65,22 @@ def file(request, group_id, file_id=None, page_no=1):
"""
ins_objectid = ObjectId()
is_video = request.GET.get('is_video', "")
if ins_objectid.is_valid(group_id) is False :
group_ins = node_collection.find_one({'_type': "Group","name": group_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)
else :
pass
# if ins_objectid.is_valid(group_id) is False :
# group_ins = node_collection.find_one({'_type': "Group","name": group_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)
# else :
# pass
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
if file_id is None:
file_ins = node_collection.find_one({'_type':"GSystemType", "name":"File"})
if file_ins:
......@@ -1204,18 +1209,23 @@ def convertVideo(files, userid, fileobj, filename):
@get_execution_time
def GetDoc(request, group_id):
ins_objectid = ObjectId()
if ins_objectid.is_valid(group_id) is False :
group_ins = node_collection.find_one({'_type': "Group","name": group_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)
else :
pass
# ins_objectid = ObjectId()
# if ins_objectid.is_valid(group_id) is False :
# group_ins = node_collection.find_one({'_type': "Group","name": group_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)
# else :
# pass
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
files = node_collection.find({'_type': u'File'})
#return files
template = "ndf/DocumentList.html"
......@@ -1225,18 +1235,23 @@ def GetDoc(request, group_id):
@get_execution_time
def file_search(request, group_id):
ins_objectid = ObjectId()
if ins_objectid.is_valid(group_id) is False :
group_ins = node_collection.find_one({'_type': "Group","name": group_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)
else :
pass
# ins_objectid = ObjectId()
# if ins_objectid.is_valid(group_id) is False :
# group_ins = node_collection.find_one({'_type': "Group","name": group_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)
# else :
# pass
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
if request.method == "GET":
keyword = request.GET.get("search", "")
file_search = node_collection.find({'$or':[{'name':{'$regex': keyword}}, {'tags':{'$regex':keyword}}]}) #search result from file
......@@ -1250,18 +1265,23 @@ def file_search(request, group_id):
def delete_file(request, group_id, _id):
"""Delete file and its data
"""
ins_objectid = ObjectId()
if ins_objectid.is_valid(group_id) is False :
group_ins = node_collection.find_one({'_type': "Group","name": group_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)
else :
pass
# ins_objectid = ObjectId()
# if ins_objectid.is_valid(group_id) is False :
# group_ins = node_collection.find_one({'_type': "Group","name": group_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)
# else :
# pass
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
auth = node_collection.one({'_type': u'Author', 'name': unicode(request.user.username) })
pageurl = request.GET.get("next", "")
try:
......@@ -1388,16 +1408,21 @@ def file_detail(request, group_id, _id):
def getFileThumbnail(request, group_id, _id):
"""Returns thumbnail of respective file
"""
ins_objectid = ObjectId()
if ins_objectid.is_valid(group_id) is False:
group_ins = node_collection.find_one({'_type': "Group", "name": group_id})
auth = node_collection.one({'_type': 'Author', 'name': unicode(request.user.username) })
if group_ins:
group_id = str(group_ins._id)
elif auth:
group_id = str(auth._id)
else:
pass
# ins_objectid = ObjectId()
# if ins_objectid.is_valid(group_id) is False:
# group_ins = node_collection.find_one({'_type': "Group", "name": group_id})
# auth = node_collection.one({'_type': 'Author', 'name': unicode(request.user.username) })
# if group_ins:
# group_id = str(group_ins._id)
# elif auth:
# group_id = str(auth._id)
# else:
# pass
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
file_node = node_collection.one({"_id": ObjectId(_id)})
"""
......@@ -1453,18 +1478,23 @@ def getFileThumbnail(request, group_id, _id):
def readDoc(request, _id, group_id, file_name=""):
'''Return Files
'''
ins_objectid = ObjectId()
if ins_objectid.is_valid(group_id) is False :
group_ins = node_collection.find_one({'_type': "Group","name": group_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)
else :
pass
# ins_objectid = ObjectId()
# if ins_objectid.is_valid(group_id) is False :
# group_ins = node_collection.find_one({'_type': "Group","name": group_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)
# else :
# pass
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
file_node = node_collection.one({"_id": ObjectId(_id)})
if file_node is not None:
......@@ -1487,18 +1517,23 @@ def readDoc(request, _id, group_id, file_name=""):
@get_execution_time
def file_edit(request,group_id,_id):
ins_objectid = ObjectId()
if ins_objectid.is_valid(group_id) is False :
group_ins = node_collection.find_one({'_type': "Group","name": group_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)
else :
pass
# ins_objectid = ObjectId()
# if ins_objectid.is_valid(group_id) is False :
# group_ins = node_collection.find_one({'_type': "Group","name": group_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)
# else :
# pass
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
group_obj = node_collection.one({'_id': ObjectId(group_id)})
file_node = node_collection.one({"_id": ObjectId(_id)})
title = GST_FILE.name
......
......@@ -761,18 +761,23 @@ def get_profile_pic(username):
def delete_forum(request,group_id,node_id,relns=None):
""" Changing status of forum to HIDDEN
"""
ins_objectid = ObjectId()
if ins_objectid.is_valid(group_id) is False :
group_ins = node_collection.find_one({'_type': "Group","name": group_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)
else :
pass
# ins_objectid = ObjectId()
# if ins_objectid.is_valid(group_id) is False :
# group_ins = node_collection.find_one({'_type': "Group","name": group_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)
# else :
# pass
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
op = node_collection.collection.update({'_id': ObjectId(node_id)}, {'$set': {'status': u"HIDDEN"}})
node=node_collection.one({'_id':ObjectId(node_id)})
#send notifications to all group members
......@@ -860,18 +865,23 @@ def delete_thread(request,group_id,forum_id,node_id):
@login_required
@get_execution_time
def edit_thread(request,group_id,forum_id,thread_id):
ins_objectid = ObjectId()
if ins_objectid.is_valid(group_id) is False :
group_ins = node_collection.find_one({'_type': "Group","name": group_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)
else :
pass
# ins_objectid = ObjectId()
# if ins_objectid.is_valid(group_id) is False :
# group_ins = node_collection.find_one({'_type': "Group","name": group_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)
# else :
# pass
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
forum=node_collection.one({'_id':ObjectId(forum_id)})
thread=node_collection.one({'_id':ObjectId(thread_id)})
exstng_reply = node_collection.find({'$and':[{'_type':'GSystem'},{'prior_node':ObjectId(forum._id)}]})
......@@ -946,7 +956,11 @@ def delete_reply(request,group_id,forum_id,thread_id,node_id):
# else :
# pass
group_name, group_id = get_group_name_id(group_id)
#group_name, group_id = get_group_name_id(group_id)
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
activity = ""
......
......@@ -26,18 +26,23 @@ def imageDashboard(request, group_id, image_id=None):
'''
fetching image acording to group name
'''
ins_objectid = ObjectId()
if ins_objectid.is_valid(group_id) is False :
group_ins = node_collection.find_one({'_type': "Group", "name": group_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)
else :
pass
# ins_objectid = ObjectId()
# if ins_objectid.is_valid(group_id) is False :
# group_ins = node_collection.find_one({'_type': "Group", "name": group_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)
# else :
# pass
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
if image_id is None:
image_ins = node_collection.find_one({'_type': "GSystemType", "name": "Image"})
if image_ins:
......@@ -53,18 +58,23 @@ def getImageThumbnail(request, group_id, _id):
'''
this funciton can be called to get thumbnail of image throw url
'''
ins_objectid = ObjectId()
if ins_objectid.is_valid(group_id) is False :
group_ins = node_collection.find_one({'_type': "Group","name": group_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)
else :
pass
# ins_objectid = ObjectId()
# if ins_objectid.is_valid(group_id) is False :
# group_ins = node_collection.find_one({'_type': "Group","name": group_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)
# else :
# pass
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
img_obj = node_collection.one({"_type": u"File", "_id": ObjectId(_id)})
if img_obj is not None:
......@@ -79,18 +89,23 @@ def getImageThumbnail(request, group_id, _id):
@get_execution_time
def getFullImage(request, group_id, _id, file_name = ""):
ins_objectid = ObjectId()
if ins_objectid.is_valid(group_id) is False :
group_ins = node_collection.find_one({'_type': "Group", "name": group_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)
else :
pass
# ins_objectid = ObjectId()
# if ins_objectid.is_valid(group_id) is False :
# group_ins = node_collection.find_one({'_type': "Group", "name": group_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)
# else :
# pass
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
img_obj = node_collection.one({"_id": ObjectId(_id)})
if img_obj is not None:
if (img_obj.fs.files.exists(img_obj.fs_file_ids[0])):
......@@ -103,18 +118,23 @@ def getFullImage(request, group_id, _id, file_name = ""):
@get_execution_time
def get_mid_size_img(request, group_id, _id):
ins_objectid = ObjectId()
if ins_objectid.is_valid(group_id) is False :
group_ins = node_collection.find_one({'_type': "Group","name": group_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)
else :
pass
# ins_objectid = ObjectId()
# if ins_objectid.is_valid(group_id) is False :
# group_ins = node_collection.find_one({'_type': "Group","name": group_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)
# else :
# pass
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
img_obj = node_collection.one({"_id": ObjectId(_id)})
try:
f = img_obj.fs.files.get(ObjectId(img_obj.fs_file_ids[2]))
......@@ -125,18 +145,23 @@ def get_mid_size_img(request, group_id, _id):
@get_execution_time
def image_search(request,group_id):
ins_objectid = ObjectId()
if ins_objectid.is_valid(group_id) is False :
group_ins = node_collection.find_one({'_type': "Group","name": group_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)
else :
pass
# ins_objectid = ObjectId()
# if ins_objectid.is_valid(group_id) is False :
# group_ins = node_collection.find_one({'_type': "Group","name": group_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)
# else :
# pass
try:
group_id = ObjectId(group_id)
except:
group_name, group_id = get_group_name_id(group_id)
imgcol = node_collection.find({"_type": "File", 'mime_type': {'$regex': 'image'}})
if request.method=="GET":
keyword=request.GET.get("search","")
......@@ -147,18 +172,23 @@ def image_search(request,group_id):
@get_execution_time
def image_detail(request, group_id, _id):
ins_objectid = ObjectId()
if ins_objectid.is_valid(group_id) is False :
group_ins = node_collection.find_one({'_type': "Group","name": group_id})
auth = node_collection.one({'_type': 'Author', 'name': unicode(request.user.username) })
if group_ins:
group_id = str(group_ins._id)
else :