#coding=utf-8 from uliweb import expose from uliweb import settings from models import mcourses from models import mc_deps_ps as cdp #depend points from models import mc_deps_cs as cdc #depend courses from uliweb.orm import get_model from forms import C_Deps_PForm as CDPForm from forms import C_Deps_CForm as CDCForm from forms import CoursesForm from points.models import events from points.models import comments from uliweb import function require_login = function('require_login') from uliweb.contrib.auth.views import login from points.forms import CommForm @expose('/course/') def index_c(): courses = mcourses.all() return {'courses':courses} @expose('/course/add_c') def add_c(): if require_login(): return redirect(url_for(login)) form = CoursesForm() if request.method == 'GET': return {'form':form} elif request.method == 'POST':
def __begin__(self): from uliweb import function return function('require_login')()
#coding=utf-8 from uliweb import function xmlrpc = function('xmlrpc') @xmlrpc def hello(): return 'hello' @xmlrpc('func') def new_func(): return 'new_func' @xmlrpc class Hello(object): def test(self, name): return {'user': name} @xmlrpc('name') def new_name(self): return 'new_name'
def __begin__(): from uliweb import function return function('has_login')()
# -*- coding: utf-8 -*- from uliweb import expose from models import blogs, comments from forms import BlogsForm, CommentsForm from uliweb import function require_login = function("require_login") from uliweb.contrib.auth.views import login @expose('/') def index(): blog = blogs.all() return {'blog':blog} @expose('/create') def create(): if require_login(): return redirect(url_for(login)) if request.method == "POST": form = BlogsForm() flag = form.validate(request.params) if flag: info = blogs(**form.data) info.username = request.user.username info.save() return redirect('/view/%d' % info.id) form = BlogsForm() return {'form':form} @expose('/view/<id>')
#coding=utf-8 from uliweb import function xmlrpc = function('xmlrpc') @xmlrpc def hello(): return 'hello' @xmlrpc('func') def new_func(): return 'new_func' @xmlrpc class Hello(object): def test(self, name): return {'user':name} @xmlrpc('name') def new_name(self): return 'new_name'
def __init__(self, application, settings): from uliweb import settings, function if settings.GLOBAL.EXCEPTION_PROCESS_TYPE == 'redis': self.redis = function('get_redis')()
#coding=utf-8 from uliweb import expose, function from cms.models import * from forms import * require_login = function('require_login') @expose('/admin') def admin(): if require_login(): return redirect(url_for(login)) if request.method == 'GET': site = siteinfo.get(siteinfo.c.id == 1) if site is None: siteform = siteinfoForm(action='/admin/siteinfo_edit') else: siteform = siteinfoForm(action="/admin/siteinfo_edit",data={'name':site.name,\ 'url':site.url,'desc':site.desc,'temp':site.temp,'logo':site.logo}) category_all = category.all() categoryform = categoryForm(action='/admin/category_new') return { 'siteform': siteform, 'category_all': category_all, 'categoryform': categoryform } @expose('/admin/siteinfo_edit') def siteinfo_edit(): if require_login(): return redirect(url_for(login))
def get_cache(): from weto.cache import NoSerial return function('get_cache')(serial_cls=NoSerial)