py3: cherry-picking fixes
a cherry pick for the arch module introduced problems with python2 and the start-wb.
This commit is contained in:
parent
31e4489518
commit
1a21a4bc96
|
@ -23,10 +23,15 @@
|
|||
|
||||
# This is the start page template
|
||||
|
||||
import os,FreeCAD,FreeCADGui,tempfile,time,zipfile,urllib,re,cStringIO
|
||||
import os,FreeCAD,FreeCADGui,tempfile,time,zipfile,urllib,re,sys
|
||||
from PySide import QtGui
|
||||
from xml.etree.ElementTree import parse
|
||||
|
||||
try:
|
||||
import io as cStringIO
|
||||
except:
|
||||
import cStringIO
|
||||
|
||||
FreeCADGui.addLanguagePath(":/translations")
|
||||
FreeCADGui.updateLocale()
|
||||
|
||||
|
@ -41,10 +46,16 @@ def translate(context,text):
|
|||
|
||||
s = cStringIO.StringIO()
|
||||
for i in u:
|
||||
if sys.version_info.major > 2: #below only works correctly in python3
|
||||
if i == 39:
|
||||
s.write("\\'")
|
||||
else:
|
||||
s.write(chr(i))
|
||||
else:
|
||||
if ord(i) == 39:
|
||||
s.write(unicode("\\'"))
|
||||
else:
|
||||
s.write(unicode(i))
|
||||
t = s.getvalue()
|
||||
s.close()
|
||||
return t
|
||||
|
@ -612,7 +623,7 @@ def getFeed(url,numitems=3):
|
|||
resp += item['title']
|
||||
resp += '</a></li>'
|
||||
resp += '</ul>'
|
||||
print resp
|
||||
print(resp)
|
||||
return resp
|
||||
|
||||
def getCustomBlocks():
|
||||
|
|
Loading…
Reference in New Issue
Block a user