Exemple #1
0
def update_mobwrite_content_org(node_system):   
  '''
	on revert or merge of nodes,a content_org is synced to mobwrite object
	input : 
		node
  ''' 
  system = node_system
  filename = TextObj.safe_name(str(system._id))
  textobj = TextObj.objects.filter(filename=filename)
  content_org = system.content_org
  if textobj:
    textobj = TextObj.objects.get(filename=filename)
    textobj.text = content_org
    textobj.save()
  else:
    textobj = TextObj(filename=filename,text=content_org)
    textobj.save()
  return textobj
Exemple #2
0
def check_existence_textObj_mobwrite(node_id):
		'''
	to check object already created or not, if not then create 
	input nodeid 
		'''		
		check = ""
		system = collection.Node.find_one({"_id":ObjectId(node_id)})
		filename = TextObj.safe_name(str(system._id))
		textobj = TextObj.objects.filter(filename=filename)
		if textobj:
			textobj = TextObj.objects.get(filename=filename)
			pass
		else:
			if system.content_org == None:
				content_org = "None"
			else :
		 		content_org = system.content_org
			textobj = TextObj(filename=filename,text=content_org)
			textobj.save()
		check = textobj.filename
		return check