-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
54 lines (42 loc) · 1.28 KB
/
main.py
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
#main.py
from usabperning import fUsabPerning
import webapp2, suku, os
from google.appengine.ext.webapp import template
import cgi, urllib
import wsgiref.handlers
class HomePage(webapp2.RequestHandler):
def get(self):
xxx = self.request.get('h')
template_values = {
'hasilnya' : xxx,
}
# print "template_values: " + xxx
path = os.path.join(os.path.dirname(__file__), 'template/index.html')
self.response.out.write(template.render(path, template_values))
class UratGanung(webapp2.RequestHandler):
def post(self):
hasil =''
kata = self.request.get('kata')
kata = str(kata)
x = len(kata)
# self.response.write("Kata yang akan diterjemahkan:<br/> " + kata)
perning = kata.split();
for i in range(0,len(perning)):
hasil += fUsabPerning(perning[i])
hasil += ' '
# print "ini hasilnya : ", hasil
self.redirect('/?' + urllib.urlencode({'h': hasil}))
# self.redirect('/')
class TentangApp(webapp2.RequestHandler):
def get(self):
path = os.path.join(os.path.dirname(__file__), 'template/naonatuh.html')
self.response.out.write(template.render(path,''))
application = webapp2.WSGIApplication([
('/input', UratGanung),
('/', HomePage),
('/naonsih', TentangApp),
], debug = True)
def main():
application.RUN()
if __name__ == '__main__':
main()