summaryrefslogtreecommitdiff
path: root/gstudio/methods.py
diff options
context:
space:
mode:
authoranujag <anujag@anujag-D630.(none)>2012-08-09 18:38:06 +0530
committeranujag <anujag@anujag-D630.(none)>2012-08-09 18:38:06 +0530
commitb1f71c5439e3bdf7a3c0fb2c1730d6242c6356d9 (patch)
treed49de61f85ce1c6bc68c5b851d9a2754b653e4a3 /gstudio/methods.py
parent1a2ce999facc219c6fe3d2a64e8a39ff09ec9e01 (diff)
downloadgnowsys-b1f71c5439e3bdf7a3c0fb2c1730d6242c6356d9.tar.gz
added loom studio
Diffstat (limited to 'gstudio/methods.py')
-rw-r--r--gstudio/methods.py46
1 files changed, 42 insertions, 4 deletions
diff --git a/gstudio/methods.py b/gstudio/methods.py
index 7040716..2b6e0ee 100644
--- a/gstudio/methods.py
+++ b/gstudio/methods.py
@@ -13,10 +13,28 @@ def delete(idnum):
def make_rep_object(title,auth_id):
new_ob = Gbobject()
- new_ob.title = title
+ new_ob.content_org=title
+ myfile = open('/tmp/file.org', 'w')
+ myfile.write(new_ob.content_org)
+ myfile.close()
+ myfile = open('/tmp/file.org', 'r')
+ myfile.readline()
+ myfile = open('/tmp/file.org', 'a')
+ myfile.write("\n#+OPTIONS: timestamp:nil author:nil creator:nil H:3 num:nil toc:nil @:t ::t |:t ^:t -:t f:t *:t <:t")
+ myfile.write("\n#+TITLE: ")
+ myfile = open('/tmp/file.org', 'r')
+ stdout = os.popen(PYSCRIPT_URL_GSTUDIO)
+ output = stdout.read()
+ data = open("/tmp/file.html")
+ data1 = data.readlines()
+ data2 = data1[67:]
+ newdata=""
+ for line in data2:
+ newdata += line.lstrip()
+ new_ob.content = newdata
+ new_ob.title = "Re: " +title
new_ob.status = 2
new_ob.slug = slugify(title)
- new_ob.content = ""
new_ob.save()
new_ob.objecttypes.add(Objecttype.objects.get(title="Reply"))
new_ob.authors.add(Author.objects.get(id=auth_id))
@@ -24,11 +42,31 @@ def make_rep_object(title,auth_id):
return new_ob
def make_topic_object(title,auth_id,content):
+ print "save"
new_ob = Gbobject()
- new_ob.title = title
+ new_ob.title = "Query: " + title
+ new_ob.content_org = content
+ myfile = open('/tmp/file.org', 'w')
+ myfile.write(new_ob.content_org)
+ myfile.close()
+ myfile = open('/tmp/file.org', 'r')
+ myfile.readline()
+ myfile = open('/tmp/file.org', 'a')
+ myfile.write("\n#+OPTIONS: timestamp:nil author:nil creator:nil H:3 num:nil toc:nil @:t ::t |:t ^:t -:t f:t *:t <:t")
+ myfile.write("\n#+TITLE: ")
+ myfile = open('/tmp/file.org', 'r')
+ stdout = os.popen(PYSCRIPT_URL_GSTUDIO)
+ output = stdout.read()
+ data = open("/tmp/file.html")
+ data1 = data.readlines()
+ data2 = data1[67:]
+ newdata=""
+ for line in data2:
+ newdata += line.lstrip()
+ new_ob.content = newdata
new_ob.status = 2
new_ob.slug = slugify(title)
- new_ob.content = content
+
new_ob.save()
new_ob.objecttypes.add(Objecttype.objects.get(title="Topic"))
new_ob.authors.add(Author.objects.get(id=auth_id))