def index(): user = ctx.request.user logging.warning('path_info: ' + ctx.request.path_info) #TODO:: complete the get_goods function goods = None logging.warning('index func is called!!!') return Jinja2Template('index.html', _user=user, _goods=goods)
def index(): user = ctx.request.user logging.warning('path_info: ' + ctx.request.path_info) goods = None #TODO:: complete the get_goods function #goods = Goods.find_by('where status = 0 limit 6',) logging.warning('index func is called!!!') return Jinja2Template('index.html',_user=user,_goods=goods)
def show_user_profile(): user = ctx.request.user user_account = user.account logging.warning('user_account: ' + user_account) account = Account.find_first('where account = ? and status = 0', user_account) return Jinja2Template('my.html', _user=user, _acct=account)
def user_register(): umsg = ctx.request.input(account='',name='',password='',birthday='',phone='',address='') account = umsg.account.strip() name = umsg.name.strip() password = umsg.password.strip() birthday = umsg.birthday.strip() phone = umsg.phone.strip() address = umsg.address.strip() if not account: msg = 'account is empty!' return Jinja2Template('msg.html',{'msg':msg}) if not name: msg = 'name is empty!' return Jinja2Template('msg.html',{'msg':msg}) if not password: msg = 'password is empty!' return Jinja2Template('msg.html',{'msg':msg}) if not birthday: msg = 'password is empty!' return Jinja2Template('msg.html',{'msg':msg}) if not phone: msg = 'phone number is empty!' return Jinja2Template('msg.html',{'msg':msg}) if not address: msg = 'address is empty!' return Jinja2Template('msg.html',{'msg':msg}) user = User.find_first(account) if user: msg = 'user has been register before!' return Jinja2Template('msg.html',{'msg':msg}) user.insert() user = None return perRedirect('/')
def static_search_goods(): user = ctx.request.user s_factor_name = ctx.request.get('s_factor_name') s_text_value = ctx.request.get('s_text_value') if s_factor_name == 'name': name = '%' + s_text_value + '%' goods = Goods.find_by('where goods_name like ? and status = 0 limit 6',name) elif s_factor_name == 'tag': #TODO: add join search mode else: price = float(s_text_value) goods = Goods.find_by('where goods_price < ? and status = 0 limit 6',price) return Jinja2Template('index.html',_user=user,_goods=goods,_s_factor_name_name=s_factor_name,_s_factor_name_value=s_text_value)
def user_register(): umsg = ctx.request.input(account='', name='', password='', birthday='', phone='', address='', post='') account = umsg.account.strip() name = umsg.name.strip() password = umsg.password.strip() birthday = umsg.birthday.strip() phone = umsg.phone.strip() address = umsg.address.strip() post = umsg.post.strip() acctstatus = 0 logging.warning('account: ' + account + ' name: ' + name + \ ' password: '******' birthday: ' + birthday + ' phone: ' + phone + ' address: ' + address + ' post: '+ post) #TODO:add some format check for the fllowing params if not account: msg = 'account is empty!' return Jinja2Template('msg.html', {'msg': msg}) if not name: msg = 'name is empty!' return Jinja2Template('msg.html', {'msg': msg}) if not password: msg = 'password is empty! damn!!! damn!!!' return Jinja2Template('msg.html', {'msg': msg}) if not birthday: msg = 'birthday is empty!' return Jinja2Template('msg.html', msg=msg) if not phone: msg = 'phone number is empty!' return Jinja2Template('msg.html', {'msg': msg}) if not address: msg = 'address is empty!' return Jinja2Template('msg.html', {'msg': msg}) user = User.find_first('where account=?', account) if user: msg = 'user has been register before!' return Jinja2Template('msg.html', {'msg': msg}) logging.warning("before add user!!!!") user = User(account=account,name=name,password=password,\ birthday=birthday,phone=phone,address=address,post=post,status=acctstatus) user.insert() status = 0 account = Account(account=account, status=status) account.insert() return tem_redirect('/')
def user_register(): umsg = ctx.request.input(account='', name='', password='', birthday='', phone='', address='', post='') account = umsg.account.strip() name = umsg.name.strip() password = umsg.password.strip() birthday = umsg.birthday.strip() phone = umsg.phone.strip() address = umsg.address.strip() post = umsg.post.strip() #TODO:add some format check for the fllowing params if not account: msg = 'account is empty!' return Jinja2Template('msg.html', {'msg': msg}) if not name: msg = 'name is empty!' return Jinja2Template('msg.html', {'msg': msg}) if not password: msg = 'password is empty!' return Jinja2Template('msg.html', {'msg': msg}) if not birthday: msg = 'password is empty!' return Jinja2Template('msg.html', {'msg': msg}) if not phone: msg = 'phone number is empty!' return Jinja2Template('msg.html', {'msg': msg}) if not address: msg = 'address is empty!' return Jinja2Template('msg.html', {'msg': msg}) user = User.find_first('where account=?', account) if user: msg = 'user has been register before!' return Jinja2Template('msg.html', {'msg': msg}) user = User(account=account,name=name,password=password,\ birthday=birthday,phone=phone,address=address,post=post) user.insert() status = 0 account = Account(account=account, status=status) account.insert() return perRedirect('/')
def showitemdetails(): #get the query_string qstr = ctx.request.query_string() #parse the query_string qstr_dict = parsequery(qstr) #get the goods_id goods_id = qstr_dict.goods_id.lower() item = Goods.find_first('where goods_id = ?',goods_id) if not item: raise perRedirect('/')#redirect to a page that buyer = None if item.buyer_account: buyer = User.find_first('where account = ?',item.buyer_account) item.img_filename = '/img/' + item.img_filename tags = Goodstag.find_by('where goods_id = ? and status = 0',goods_id) _user = ctx.request.user return Jinja2Template('item_detail.html',_user=user,_item=item, _buyer=buyer,_tags=tags)
def register(): return Jinja2Template('register.html', )
def index(): user = ctx.request.user #implemet get_goods return Jinja2Template('index.html',_user=user,goods=_goods)
def show_buy_items(): user = ctx.request.user return Jinja2Template('my_buy.html',_user=user)
def show_sell_items(): user = ctx.request.user #TODO: add the paging function return Jinja2Template('my_sell.html',_user=user)
def show_user_profile(): user = ctx.request.user account = Account.find_first('where account = ? and status = 0',account) return Jinja2Template('my.html',_user=user, _acct=account)