From 975e4380ea41eb151f5488da436e28c7b1d1082a Mon Sep 17 00:00:00 2001 From: Kabir Kukreti Date: Tue, 4 Sep 2012 23:46:35 +0530 Subject: Unicode error solved and unicode support added --- gstudio/methods.py | 4 +++- gstudio/views/pageadd.py | 4 ++-- gstudio/views/sectionadd1.py | 4 ++-- gstudio/views/topicadd.py | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) (limited to 'gstudio') diff --git a/gstudio/methods.py b/gstudio/methods.py index ad4bcee7..bdcc5ad9 100644 --- a/gstudio/methods.py +++ b/gstudio/methods.py @@ -202,7 +202,9 @@ def create_wikipage(title,idusr,content_org): sys = System() sys.title = title sys.status = 2 - sys.content_org= content_org + contorg = unicode(content_org) + sys.content_org = contorg.encode('utf8') + myfile = open('/tmp/file.org', 'w') myfile.write(sys.content_org) myfile.close() diff --git a/gstudio/views/pageadd.py b/gstudio/views/pageadd.py index 4f63ead0..d51017cc 100644 --- a/gstudio/views/pageadd.py +++ b/gstudio/views/pageadd.py @@ -29,9 +29,9 @@ def pageadd(request): # if not request.POST.get('org1', ''): # errors.append('Enter a page.') if not errors: - title=request.POST['subject'] + title=unicode(request.POST['subject']) # content=request.POST['page'] - content_org=request.POST['org1'] + content_org=unicode(request.POST['org1']) idusr=request.POST['idusr'] pageId = create_wikipage(title,int(idusr),content_org) if pageId : diff --git a/gstudio/views/sectionadd1.py b/gstudio/views/sectionadd1.py index 0c5643ca..8bc3dd1c 100644 --- a/gstudio/views/sectionadd1.py +++ b/gstudio/views/sectionadd1.py @@ -19,9 +19,9 @@ def sectionadd1(request,pageid): if not request.POST.get('org', ''): errors.append('Enter a page.') if not errors: - title=request.POST['subject'] + title=unicode(request.POST['subject']) # content=request.POST['page'] - content_org=request.POST['org'] + content_org=unicode(request.POST['org']) idusr=request.POST['idusr'] tp = make_section_object(title,int(idusr),content_org) System.objects.get(id=int(pageid)).system_set.all()[0].gbobject_set.add(tp) diff --git a/gstudio/views/topicadd.py b/gstudio/views/topicadd.py index ba094c53..31e780e2 100644 --- a/gstudio/views/topicadd.py +++ b/gstudio/views/topicadd.py @@ -32,8 +32,8 @@ def topicadd(request): if not request.POST.get('message', ''): errors.append('Enter a message.') if not errors: - title=request.POST['subject'] - content=request.POST['message'] + title=unicode(request.POST['subject']) + content=unicode(request.POST['message']) idusr=request.POST['idusr'] boolean = make_topic_object(title,int(idusr),content) if boolean : -- cgit v1.2.3-70-g09d2