예제 #1
0
파일: views.py 프로젝트: asmcos/jeap
#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':
예제 #2
0
 def __begin__(self):
     from uliweb import function
     return function('require_login')()
예제 #3
0
 def __begin__(self):
     from uliweb import function
     return function('require_login')()
예제 #4
0
#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'
예제 #5
0
def __begin__():
    from uliweb import function
    return function('has_login')()
예제 #6
0
# -*- 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>')
예제 #7
0
#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' 
예제 #8
0
    def __init__(self, application, settings):
        from uliweb import settings, function

        if settings.GLOBAL.EXCEPTION_PROCESS_TYPE == 'redis':
            self.redis = function('get_redis')()
예제 #9
0
#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))
예제 #10
0
def get_cache():
    from weto.cache import NoSerial
    return function('get_cache')(serial_cls=NoSerial)
예제 #11
0
파일: __init__.py 프로젝트: bobgao/uliweb
def get_cache():
    from weto.cache import NoSerial
    return function('get_cache')(serial_cls=NoSerial)