1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
|
from gstudio.models import *
from objectapp.models import *
from django.template.defaultfilters import slugify
import datetime
import os
from demo.settings import PYSCRIPT_URL_GSTUDIO
from demo.settings import FILE_URL
def get_threadbox_of_twist(twistid):
thid=""
for each in System.objects.all():
sys_set=each.system_set.all()
if sys_set:
sys_set=each.system_set.all()[0]
for eachsys in sys_set.gbobject_set.all():
if eachsys.id==twistid:
return sys_set
return thid
def delete(idnum):
del_ob = Gbobject.objects.get(id=idnum)
del_ob.delete()
return True
def make_rep_object(title,auth_id,usr):
new_ob = Gbobject()
new_ob.title = "Re: "
new_ob.slug=slugify(new_ob.title)
new_ob.save()
titleid = "Re:"+str(new_ob.id)
contorg = unicode(title)
fname=slugify(titleid)+"-"+usr
new_ob.content_org=contorg.encode('utf8')
ext='.org'
html='.html'
myfile = open(os.path.join(FILE_URL,fname+ext),'w')
myfile.write(new_ob.content_org)
myfile.close()
myfile = open(os.path.join(FILE_URL,fname+ext),'r')
rfile=myfile.readlines()
scontent="".join(rfile)
newcontent=scontent.replace("\r","")
myfile = open(os.path.join(FILE_URL,fname+ext),'w')
myfile.write(newcontent)
myfile = open(os.path.join(FILE_URL,fname+ext),'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(os.path.join(FILE_URL,fname+ext),'r')
stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL))
output = stdout.read()
data = open(os.path.join(FILE_URL,fname+html))
data1 = data.readlines()
data2 = data1[107:]
dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n'
data3 = data2[:-6]
newdata=""
for line in data3:
newdata += line.lstrip()
new_ob.content = newdata
new_ob.title = "Re: "
new_ob.status = 2
new_ob.slug = slugify(title)
new_ob.save()
new_ob.objecttypes.add(Objecttype.objects.get(title="Reply"))
new_ob.authors.add(Author.objects.get(id=auth_id))
new_ob.sites.add(Site.objects.get_current())
return new_ob
def edit_section(sec_id,title,usr):
new_ob = Gbobject.objects.get(id=int(sec_id))
contorg = unicode(title)
new_ob.content_org=contorg.encode('utf8')
ssid=new_ob.get_ssid.pop()
fname=str(ssid)+"-"+usr
ext='.org'
html='.html'
myfile = open(os.path.join(FILE_URL,fname+ext),'w')
myfile.write(new_ob.content_org)
myfile.close()
myfile = open(os.path.join(FILE_URL,fname+ext),'r')
rfile=myfile.readlines()
scontent="".join(rfile)
newcontent=scontent.replace("\r","")
myfile = open(os.path.join(FILE_URL,fname+ext),'w')
myfile.write(newcontent)
#myfile.readline()
myfile = open(os.path.join(FILE_URL,fname+ext),'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(os.path.join(FILE_URL,fname+ext),'r')
stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL))
output = stdout.read()
data = open(os.path.join(FILE_URL,fname+html))
data1 = data.readlines()
data2 = data1[107:]
dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n'
data3 = data2[:-6]
newdata=""
for line in data3:
newdata += line.lstrip()
new_ob.content = newdata
new_ob.save()
return True
def make_topic_object(title,auth_id,content,usr):
new_ob = Gbobject()
new_ob.title = "Twist: " + title
contorg = unicode(content)
fname=slugify(title)+"-"+usr
new_ob.content_org=contorg.encode('utf8')
ext='.org'
html='.html'
myfile = open(os.path.join(FILE_URL,fname+ext),'w')
myfile.write(new_ob.content_org)
myfile.close()
myfile = open(os.path.join(FILE_URL,fname+ext),'r')
rfile=myfile.readlines()
scontent="".join(rfile)
newcontent=scontent.replace("\r","")
myfile = open(os.path.join(FILE_URL,fname+ext),'w')
myfile.write(newcontent)
#myfile.readline()
myfile = open(os.path.join(FILE_URL,fname+ext),'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(os.path.join(FILE_URL,fname+ext),'r')
stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL))
output = stdout.read()
data = open(os.path.join(FILE_URL,fname+html))
data1 = data.readlines()
data2 = data1[107:]
dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n'
data3 = data2[:-6]
newdata=""
for line in data3:
newdata += line.lstrip()
new_ob.content = newdata
new_ob.status = 2
new_ob.slug = slugify(title)
new_ob.save()
new_ob.objecttypes.add(Objecttype.objects.get(title="Topic"))
new_ob.authors.add(Author.objects.get(id=auth_id))
new_ob.sites.add(Site.objects.get_current())
return new_ob
def make_sectionreply_object(content_org,title,auth_id,usr):
new_ob = Gbobject()
new_ob.title = title
new_ob.status = 2
new_ob.slug = slugify(title)
contorg = unicode(content_org)
fname=slugify(title)+"-"+usr
new_ob.content_org=contorg.encode('utf8')
ext='.org'
html='.html'
myfile = open(os.path.join(FILE_URL,fname+ext),'w')
myfile.write(new_ob.content_org)
myfile.close()
myfile = open(os.path.join(FILE_URL,fname+ext),'r')
rfile=myfile.readlines()
scontent="".join(rfile)
newcontent=scontent.replace("\r","")
myfile = open(os.path.join(FILE_URL,fname+ext),'w')
myfile.write(newcontent)
#myfile.readline()
myfile = open(os.path.join(FILE_URL,fname+ext),'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(os.path.join(FILE_URL,fname+ext),'r')
stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL))
output = stdout.read()
data = open(os.path.join(FILE_URL,fname+html))
data1 = data.readlines()
data2 = data1[107:]
dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n'
data3 = data2[:-6]
newdata=""
for line in data3:
newdata += line.lstrip()
new_ob.content = newdata
myfile = open('/tmp/file.org', 'w')
# myfile.write(new_ob.content_org)
# myfile.close()
new_ob.save()
new_ob.objecttypes.add(Objecttype.objects.get(title="Subsection"))
new_ob.authors.add(Author.objects.get(id=auth_id))
new_ob.sites.add(Site.objects.get_current())
return new_ob
def make_section_object(title,auth_id,content_org,usr):
new_ob = Gbobject()
new_ob.title = title
new_ob.status = 2
new_ob.slug = slugify(title)
fname=slugify(title)+"-"+usr
#new_ob.content = content
contorg = unicode(content_org)
new_ob.content_org=contorg.encode('utf8')
ext='.org'
html='.html'
myfile = open(os.path.join(FILE_URL,fname+ext),'w')
myfile.write(new_ob.content_org)
myfile.close()
myfile = open(os.path.join(FILE_URL,fname+ext),'r')
rfile=myfile.readlines()
scontent="".join(rfile)
newcontent=scontent.replace("\r","")
myfile = open(os.path.join(FILE_URL,fname+ext),'w')
myfile.write(newcontent)
#myfile.readline()
myfile = open(os.path.join(FILE_URL,fname+ext),'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(os.path.join(FILE_URL,fname+ext),'r')
stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL))
output = stdout.read()
data = open(os.path.join(FILE_URL,fname+html))
data1 = data.readlines()
data2 = data1[107:]
dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n'
data3 = data2[:-6]
newdata=""
for line in data3:
newdata += line.lstrip()
new_ob.content = newdata
new_ob.save()
new_ob.objecttypes.add(Objecttype.objects.get(title="Section"))
new_ob.authors.add(Author.objects.get(id=auth_id))
new_ob.sites.add(Site.objects.get_current())
return new_ob
def make_relation(rep,id_no,idusr,usr):
r = make_rep_object(rep,idusr,usr)
t = Gbobject.objects.get(id=id_no)
t.posterior_nodes.add(r)
r.prior_nodes.add(t)
r.title="Re:"+str(r.id)+t.title
r.slug=slugify(r.title)
r.save()
return True
def make_sectionrelation(rep,ptitle,id_no,idusr,usr):
r = make_sectionreply_object(rep,ptitle,idusr,usr)
t = Gbobject.objects.get(id=id_no)
t.posterior_nodes.add(r)
r.prior_nodes.add(t)
return True
def rate_it(topic_id,request,rating):
ob = Gbobject.objects.get(id=topic_id)
ob.rating.add(score=rating ,user=request.user, ip_address=request.META['REMOTE_ADDR'])
return True
def rate_section(section_id,request,rating):
ob = Gbobject.objects.get(id=section_id)
ob.rating.add(score=rating ,user=request.user, ip_address=request.META['REMOTE_ADDR'])
return True
def create_meeting(title,idusr,content,usr):
sys = System()
sys.title = title
sys.status = 2
contorg = unicode(content)
sys.content_org=contorg.encode('utf8')
fname=slugify(title)+"-"+usr
ext='.org'
html='.html'
myfile = open(os.path.join(FILE_URL,fname+ext),'w')
myfile.write(sys.content_org)
myfile.close()
myfile = open(os.path.join(FILE_URL,fname+ext),'r')
rfile=myfile.readlines()
scontent="".join(rfile)
newcontent=scontent.replace("\r","")
myfile = open(os.path.join(FILE_URL,fname+ext),'w')
myfile.write(newcontent)
# myfile.readline()
myfile = open(os.path.join(FILE_URL,fname+ext),'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(os.path.join(FILE_URL,fname+ext),'r')
stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL))
output = stdout.read()
data = open(os.path.join(FILE_URL,fname+html))
data1 = data.readlines()
data2 = data1[107:]
dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n'
data3 = data2[:-6]
newdata=""
for line in data3:
newdata += line.lstrip()
sys.content = newdata
sys.slug = slugify(title)
sys.save()
sys.systemtypes.add(Systemtype.objects.get(title="Meeting"))
sys.authors.add(Author.objects.get(id=idusr))
a = Attribute()
a.title = "released button of " + title
a.slug = slugify(a.title)
a.content = a.slug
a.status = 2
a.subject = sys
a.svalue = "False"
a.attributetype_id = Attributetype.objects.get(title="release").id
a.save()
sys1 = System()
sys1.title = "message box of " + title
sys1.status = 2
sys1.content = "contains messages of " + title
sys1.slug = "message_box_of_" + slugify(title)
sys1.save()
sys1.systemtypes.add(Systemtype.objects.get(title="message_box"))
sys.system_set.add(sys1)
sys.member_set.add(Author.objects.get(id=idusr))
sys.sites.add(Site.objects.get_current())
sys1.sites.add(Site.objects.get_current())
return sys.id
def create_wikipage(title,idusr,content_org,usr):
sys = System()
sys.title = title
sys.status = 2
contorg = unicode(content_org)
sys.content_org=contorg.encode('utf8')
ext='.org'
html='.html'
fname=slugify(title)+"-"+usr
myfile = open(os.path.join(FILE_URL,fname+ext),'w')
myfile.write(sys.content_org)
myfile.close()
myfile = open(os.path.join(FILE_URL,fname+ext),'r')
rfile=myfile.readlines()
scontent="".join(rfile)
newcontent=scontent.replace("\r","")
myfile = open(os.path.join(FILE_URL,fname+ext),'w')
myfile.write(newcontent)
#myfile.readline()
myfile = open(os.path.join(FILE_URL,fname+ext),'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(os.path.join(FILE_URL,fname+ext),'r')
stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL))
output = stdout.read()
data = open(os.path.join(FILE_URL,fname+html))
data1 = data.readlines()
data2 = data1[86:]
dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n'
data3 = data2[:-6]
newdata=""
for line in data3:
newdata += line.lstrip()
sys.content = newdata
sys.slug = slugify(title)
sys.save()
sys.systemtypes.add(Systemtype.objects.get(title="Wikipage"))
sys.authors.add(Author.objects.get(id=idusr))
#a = Attribute()
#a.title = "released button of " + title
#a.slug = slugify(a.title)
#a.content = a.slug
#a.status = 2
#a.subject = sys
#a.svalue = "False"
#a.attributetype_id = Attributetype.objects.get(title="pagerelease").id
#a.save()
sys1 = System()
sys1.title = "page box of " + title
sys1.status = 2
sys1.content = "contains pages of " + title
sys1.slug = "page_box_of_" + slugify(title)
sys1.save()
sys1.systemtypes.add(Systemtype.objects.get(title="page_box"))
sys.system_set.add(sys1)
sys.member_set.add(Author.objects.get(id=idusr))
sys.sites.add(Site.objects.get_current())
sys1.sites.add(Site.objects.get_current())
return sys.id
def make_att_true(meet_ob):
for each in meet_ob.subject_of.all():
if(each.attributetype.title=='release'):
each.svalue = "true"
meet_ob.subject_of.add(each)
break
def make_att_false(meet_ob):
for each in meet_ob.subject_of.all():
if(each.attributetype.title=='release'):
each.svalue = ""
meet_ob.subject_of.add(each)
break
#def make_att1_true(page_ob):
# for each in page_ob.subject_of.all():
# if(each.attributetype.title=='pagerelease'):
# each.svalue = "true"
# page_ob.subject_of.add(each)
# break
#def make_att1_false(page_ob):
# for each in page_ob.subject_of.all():
# if(each.attributetype.title=='pagerelease'):
# each.svalue = ""
# page_ob.subject_of.add(each)
# break
def schedule_time(stTime, endTime, sys_id):
sys=System.objects.get(id=sys_id)
atty1=Attributetype.objects.get(title='timeofstart')
atty2=Attributetype.objects.get(title='timeofend')
ate= AttributeDateTimeField()
ats= AttributeDateTimeField()
ats.title='starttime of '+ sys.title;ats.slug=slugify(ats.title);
ats.subject=sys; ats.value=stTime; ats.attributetype=atty1;
ate.title='endtime of '+ sys.title;ate.slug=slugify(ate.title);
ate.subject=sys; ate.value=endTime; ate.attributetype=atty2;
ate.save()
ats.save()
#sys.save()
return sys.id
def make_title(id_no):
i = Gbobject.objects.get(id=id_no)
return "Subsection of:"+i.title
def get_time(sys_id):
later = False
meetover = False
sys=System.objects.get(id=sys_id)
now=datetime.datetime.now()
for each in AttributeDateTimeField.objects.all():
if(each.attributetype.title=='timeofstart' and each.subject.title==sys.title):
starttime=each.value
if (now - starttime)< datetime.timedelta (minutes = 1):
later=True
else:
later = False
if(each.attributetype.title=='timeofend' and each.subject.title==sys.title):
endtime=each.value
if(now-endtime)>datetime.timedelta(minutes=1):
meetover=True
else:
meetover=False
return (later, meetover, starttime, endtime)
def del_comment(comment_id):
ob = Gbobject.objects.get(id=int(comment_id))
for each in ob.posterior_nodes.all():
del_comment(each.id)
ob.delete()
return True
def del_topic(topic_id):
ob = Gbobject.objects.get(id=int(topic_id))
for each in ob.posterior_nodes.all():
del_comment(each.id)
ob.delete()
return True
def del_section(section_id):
ob = Gbobject.objects.get(id=int(section_id))
for each in ob.posterior_nodes.all():
del_comment(each.id)
ob.delete()
return True
def edit_topic(topic_id,title,usr):
ob=Gbobject.objects.get(id=int(topic_id))
contorg = unicode(title)
ob.content_org=contorg.encode('utf8')
ssid=ob.get_ssid.pop()
fname=str(ssid)+"-"+usr
ext='.org'
html='.html'
myfile = open(os.path.join(FILE_URL,fname+ext),'w')
myfile.write(ob.content_org)
myfile.close()
myfile = open(os.path.join(FILE_URL,fname+ext),'r')
rfile=myfile.readlines()
scontent="".join(rfile)
newcontent=scontent.replace("\r","")
myfile = open(os.path.join(FILE_URL,fname+ext),'w')
myfile.write(newcontent)
#myfile.readline()
myfile = open(os.path.join(FILE_URL,fname+ext),'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(os.path.join(FILE_URL,fname+ext),'r')
stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL))
output = stdout.read()
data = open(os.path.join(FILE_URL,fname+html))
data1 = data.readlines()
data2 = data1[107:]
dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n'
data3 = data2[:-6]
newdata=""
for line in data3:
newdata += line.lstrip()
ob.content = newdata
ob.save()
return True
def edit_thread(thread_id,title,usr):
ob=System.objects.get(id=int(thread_id))
contorg = unicode(title)
ssid=ob.get_ssid.pop()
fname=str(ssid)+"-"+usr
ob.content_org=contorg.encode('utf8')
ext='.org'
html='.html'
myfile = open(os.path.join(FILE_URL,fname+ext),'w')
myfile.write(ob.content_org)
myfile.close()
myfile = open(os.path.join(FILE_URL,fname+ext),'r')
rfile=myfile.readlines()
scontent="".join(rfile)
newcontent=scontent.replace("\r","")
myfile = open(os.path.join(FILE_URL,fname+ext),'w')
myfile.write(newcontent)
#myfile.readline()
myfile = open(os.path.join(FILE_URL,fname+ext),'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(os.path.join(FILE_URL,fname+ext),'r')
stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL))
output = stdout.read()
data = open(os.path.join(FILE_URL,fname+html))
data1 = data.readlines()
data2 = data1[107:]
dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n'
data3 = data2[:-6]
newdata=""
for line in data3:
newdata += line.lstrip()
ob.content = newdata
ob.save()
return True
def edit_nodetype(iden,rep,usr):
nid = NID.objects.get(id = iden)
ssid=nid.get_ssid.pop()
fname=str(ssid)+"-"+usr
refobj = nid.ref
refobj.content_org = rep
#orgcontent = request.GET["content_org"]
ext='.org'
html='.html'
#usr=str(request.user)
myfile = open(os.path.join(FILE_URL,fname+ext),'w')
myfile.write(refobj.content_org)
myfile.close()
myfile = open(os.path.join(FILE_URL,fname+ext),'r')
rfile=myfile.readlines()
scontent="".join(rfile)
newcontent=scontent.replace("\r","")
myfile = open(os.path.join(FILE_URL,fname+ext),'w')
myfile.write(newcontent)
myfile = open(os.path.join(FILE_URL,fname+ext),'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(os.path.join(FILE_URL,fname+ext),'r')
stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL))
output = stdout.read()
data = open(os.path.join(FILE_URL,fname+html))
data1 = data.readlines()
data2 = data1[107:]
dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n'
data3 = data2[:-6]
newdata=""
for line in data3:
newdata += line.lstrip()
refobj.content= newdata
refobj.save()
return True
def check_release_or_not(meet_ob):
fl = 0
for each in meet_ob.subject_of.all():
if (each.attributetype.title=='release' and each.svalue=='true'):
fl=1
return fl
def check_subscribe_or_not(meet_ob,user):
fl=0
box=meet_ob.system_set.all()[0]
ch=Author.objects.filter(id=user.id)
if ch:
ch=Author.objects.get(id=user.id)
else:
ch=""
for each in box.member_set.all():
if each == ch:
fl=1
return fl
def check_usr_admin(userid):
fl=0
aut=Author.objects.filter(id=userid)
if aut:
aut=Author.objects.get(id=userid)
if aut.is_superuser:
fl=1
return fl
def get_factory_loom_OTs():
retlist=[]
for each in Objecttype.objects.all():
if each.parent:
if ((each.parent.title=='Factory_Object') and (str(each.slug)[0:4]=='loom')):
retlist.append(each.title)
return retlist
def get_home_content():
homeobj=Gbobject.objects.filter(title="home_specific_detail")
if homeobj:
homeobj=Gbobject.objects.get(title="home_specific_detail")
return homeobj.content
def get_more_content():
moreobj=Gbobject.objects.filter(title="more_specific_detail")
if moreobj:
moreobj=Gbobject.objects.get(title="more_specific_detail")
return moreobj.content
def get_home_title():
homeobj=Gbobject.objects.filter(title="home_title")
content = ""
if homeobj:
homeobj=Gbobject.objects.get(title="home_title")
content = homeobj.content
return content
|