summaryrefslogtreecommitdiffstats
path: root/silpa/utils
diff options
context:
space:
mode:
authorSanthosh Thottingal <santhosh.thottingal@gmail.com>2009-05-24 13:04:44 +0530
committerSanthosh Thottingal <santhosh.thottingal@gmail.com>2009-05-24 13:04:44 +0530
commit30c1b89bec818490131780389c918f8bcfb7aef6 (patch)
treed0a5b076a8781247932e7b507124705f9f3e2f03 /silpa/utils
parent5a2dfd79178371a529053795d90b48dd96421d88 (diff)
downloadRachana.git-30c1b89bec818490131780389c918f8bcfb7aef6.tar.gz
Rachana.git-30c1b89bec818490131780389c918f8bcfb7aef6.tar.xz
Rachana.git-30c1b89bec818490131780389c918f8bcfb7aef6.zip
Miscellaneous bug fixes, hit counter, static pages
Diffstat (limited to 'silpa/utils')
-rw-r--r--silpa/utils/langdetect.py16
-rw-r--r--silpa/utils/silpautils.py18
2 files changed, 32 insertions, 2 deletions
diff --git a/silpa/utils/langdetect.py b/silpa/utils/langdetect.py
index 727ea6d..2ed7c6f 100644
--- a/silpa/utils/langdetect.py
+++ b/silpa/utils/langdetect.py
@@ -21,27 +21,39 @@ class LangDetect(SilpaModule):
index = 0
while index < length:
letter=word[index]
+ if not letter.isalpha():
+ index=index+1
+ continue
if ((letter >= u'ം') & (letter <=u'൯')):
result_dict[word]= "ml_IN"
+ break;
if ((letter >= u'ঁ') & (letter <= u'৺')):
result_dict[word]= "bn_IN"
+ break
if ((letter >= u'ँ') & (letter <= u'ॿ')):
result_dict[word]= "hi_IN"
+ break
if ((letter >=u'ઁ') & (letter <= u'૱')):
result_dict[word]= "gu_IN"
+ break
if ((letter >= u'ਁ') & (letter <=u'ੴ')):
result_dict[word]= "pa_IN"
+ break
if ((letter >= u'ಂ') & (letter <=u'ೲ')):
- result_dict[word]= "ka_IN"
+ result_dict[word]= "kn_IN"
+ break
if ((letter >= u'ଁ') & (letter <= u'ୱ')):
result_dict[word]= "or_IN"
+ break
if ((letter >=u'ஂ') & (letter <= u'௺')):
result_dict[word]= "ta_IN"
+ break
if ((letter >=u'ఁ') & (letter <= u'౯')):
result_dict[word]= "te_IN"
+ break
if ((letter <= u'z')):
result_dict[word]= "en_US"
-
+ break
index=index+1
word_iter=word_iter+1
return result_dict
diff --git a/silpa/utils/silpautils.py b/silpa/utils/silpautils.py
index 02556af..25a3df8 100644
--- a/silpa/utils/silpautils.py
+++ b/silpa/utils/silpautils.py
@@ -14,6 +14,24 @@ def getModulesList():
if(item.startswith("SILPA_ACTION.")):
action_dict[item.replace("SILPA_ACTION.","")]=conf_dict[item]
return action_dict
+def getStaticContent(page):
+ try:
+ return open("doc/"+page).read()
+ except:
+ return "Could not find the requested page "+ page
+def handleStats():
+ Hits="0"
+ try:
+ InFile = open("count.dat", "r") # Text file with total hits
+ Hits = InFile.readline()
+ except:
+ pass
+ x = int(Hits) + 1
+ h = str(x)
+ OutFile = open("count.dat", "w")
+ OutFile.write(str(x))
+ OutFile.close()
+
def loadConfiguration():
conf_dict={}
conffile = codecs. open("silpa.conf",encoding='utf-8', errors='ignore')