def __auto__(self): self.pm = cur_pm() self.auth = Auth() gest = self.auth.user() if not gest: self.auth.user('1') render('common_header')
def reg(self, name='', password='', email=''): """ @param: name, password, email """ if web.ctx.method == 'POST': u = model.User(name, email, password) self.pm.persist(u) render('reg')
def study(self): o = self.pm.load_obj('User', uid) if not o.order_id: redirect('/sales/pay') #study # 1。阅读 # 3. 评分。 # 2. 工作记录 # 3. 感悟 render('study')
def story_detail(self, id='01'): """ @param: id """ import config webroot = config.views_config['template'] story_file = os.path.join(webroot, 'book', "%s.txt" % id) if not os.path.isfile(story_file): return "Not found id %s" % id #f = open("story_file") content = [] with open(story_file) as f: for line in f: content.append(line) render('story', content)
def pay(self, c='100'): """ @param: c """ v_mid = "20452979" v_key = "myww028.comtest" #20081008-20452979-214 date = strftime('%Y%m%d', localtime()) v_oid = "%s-%s-a%s" % (date, v_mid, self.auth.user()) v_url = "http://www.bestsales.com/sales/pay_back" text = c + 'CNY' + v_oid + v_mid + v_url + v_key v_md5 = md5.new(text).hexdigest().upper() pay = {'v_mid':v_mid, 'v_oid':v_oid, 'v_amount':c, 'v_url':v_url, 'v_md5info':v_md5 } render('pay', pay)
def story(self, conn_id='test'): """ @param: conn_id """ render('story_list', '中文')
def index(self): render('index', '中文')
def __post__(self): render('common_footer') self.auth.update_session()