Commits

gao shuai committed 4f6eca9

增加 一个 指向show的链接

Comments (0)

Files changed (6)

-application: kubaofy
+application: wdfanyi
 version: test
 runtime: python
 api_version: 1
 # -*- coding: utf-8 -*-
 PAGE_SIZE=10
+LI_LIMIT=8
+SWAP_LIMIT=3
+WORDS_LIMIT=3
+WIKI_LIMIT=8
 import math
 import urllib
 import os
 class Mainpage(yui.HtmlRequestHandler):
 	def get(self,flag):
 		try:
-			WORDS=words.all().order("-time").fetch(limit=3)
-			WIKIS=wiki.all().order("-time").fetch(limit=3)
-			SWAPS=swap.all().order("-time").fetch(limit=2,offset=0)
+			WORDS=words.all().order("-time").fetch(limit=WORDS_LIMIT)
+			WIKIS=wiki.all().order("-time").fetch(limit=WIKI_LIMIT)
+			SWAPS=swap.all().order("-time").fetch(limit=SWAP_LIMIT,offset=0)
 			LASTSWAP=swap.all().order("-time").fetch(limit=1)[0].content
-			LIS=li.all().order("-time").fetch(limit=2,offset=0)
+			LIS=li.all().order("-time").fetch(limit=LI_LIMIT,offset=0)
 			LASTLI=li.all().order("-time").fetch(limit=1)[0].content
 		except IndexError:
 			WORDS=None
 		WORD.user='weakdancer'
 
 		if ord(text[0])<=127:
-			WORD.EN=text.strip().lower()
+			WORD.EN=text.strip().lower().strip()
 			WORD.CN=en2c(text)
 		else:
 			WORD.CN=text
-			WORD.EN=c2en(text).strip()
+			WORD.EN=c2en(text).lower().strip()
 
 		WORD.time=getCNnow()
 		WORD.put()
 		self.write(WORD.EN)
 	def post(self):
-		text=self.request.get('word').strip().lower()
+		text=self.request.get('word')
 		WORD=words()
 		WORD.user='weakdancer'
 		if ord(text[0])<=127:
-			WORD.EN=text
+			WORD.EN=text.lower().strip()
 			WORD.CN=en2c(text)
 		else:
 			WORD.CN=text
-			WORD.EN=c2en(text)
+			WORD.EN=c2en(text).lower().strip()
 		WORD.time=getCNnow()
 		WORD.put()
 		self.write(WORD.EN)
     {% include 'seo.html' %}
 </head>
   <body>
-
+<a href='/show/li'>LI</a>
 
 <div style="float:auto;width:auto;margin-right: auto; margin-left: auto;">
 	{% for LI in LIS %}
     {% include 'seo.html' %}
 </head>
   <body>
-
+<a href='/show/swap'>SWAP</a>
 
 <div style="float:auto;width:auto;margin-right: auto; margin-left: auto;">
 	{% for SWAP in SWAPS %}
     {% include 'seo.html' %}
 </head>
   <body>
-
+<a href='/show/wiki'>WIKI</a>
 <div style="text-align:center;float:center;width:auto;margin-right: auto; margin-left: auto;">
 
 	{% for WIKI in WIKIS %}
 </head>
   <body>
 
-
+<a href='/show/words'>WORDS</a>
 
 <div style="text-align:center;float:center;width:auto;margin-right: auto; margin-left: auto;">
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.