This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define([ "when/parallel", "jquery" ], function (parallel, $) { | |
var tasks = [ "url1", "url2", "url3" ].map(function (url) { | |
return function () { | |
return $.get(url); | |
}; | |
}); | |
parallel(tasks) | |
.then(function (results) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
from flask import request, g | |
from functools import wraps | |
from flask import abort, session, redirect, url_for, flash | |
from .models import Topic, Attachment | |
from . import roles | |
def require_visitor(func): | |
"""仅允许非登陆用户访问,如signin页面""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.route('/', methods=['GET', 'POST']) | |
def demo(): | |
conn=pymssql.connect(host='blablabla\SQLEXPRESS',user='blabla',password='123',database='x',charset='utf8') | |
cur=conn.cursor() | |
sqlquery=u"SELECT TOP 1000 [ID],[姓名],[内容] FROM demo_db" | |
sqlquery=sqlquery.encode("utf8") | |
cur.execute(sqlquery) | |
row=cur.fetchone() | |
cts = [dict(name=row[1],ct=row[2]) for row in cur.fetchall()] | |
for i in cts: |
NewerOlder