於是我也不知道去哪裡想出來的方法,配合template語法,在for裡加入ifchanged就可以有Distinct效果
{% for i in billdb %}
{% ifchanged %}
<option value="{{i.bill_idnum}}">{{i.bill_idnum}}</option>
{% endifchanged %}
{% endfor %}
{% for i in billdb %}
{% ifchanged %}
<option value="{{i.bill_idnum}}">{{i.bill_idnum}}</option>
{% endifchanged %}
{% endfor %}
import captcha
from google.appengine.ext import webapp
# Captcha
domain_name = 'you_domain_name'
public_key = 'public_key'
private_key = 'private_key'
class test(webapp.RequestHandler):
def get(self):
captcha_html = captcha.displayhtml(public_key)
self.response.out.write(captcha_html)
def post(self):
recaptcha_challenge_field = self.request.get('recaptcha_challenge_field')
recaptcha_response_field = self.request.get('recaptcha_response_field')
private_key = private_key
remoteip = domain_name
ans = captcha.submit(recaptcha_challenge_field,recaptcha_response_field,private_key,remoteip)
self.response.out.write('ans= '+str(ans.is_valid))
COOKIE_KEY = 'do not use this key'更改成
COOKIE_KEY = os.urandom(64)
session = get_current_session() session['a'] ='a' session.has_key('a') session.terminate()
session = get_current_session()建立 session
session['a'] ='a'設立一個為a的session值為'a'
session.has_key('a')判斷是否有a這個session return bool
session.terminate()刪除session並終止該用戶
application: hello version: 1 runtime: python api_version: 1 handlers: - url: / script: main.py
print 'Content-Type: text/plain' print '' print 'Hello, world'
INFO 2010-07-15 20:26:11,663 appengine_rpc.py:159] Server: appengine.google.com INFO 2010-07-15 20:26:11,671 appcfg.py:357] Checking for updates to the SDK. INFO 2010-07-15 20:26:15,536 appcfg.py:366] Update check failed: <urlopen error The read operation timed out> INFO 2010-07-15 20:26:15,661 dev_appserver_main.py:431] Running application hello on port 8080: http://localhost:8080