예제 #1
0
def getWebParaValue(*ks):
    ret = {}
    wvs = webapi.input(_unicode=False)
    for k in ks:
        if (k in wvs):
            ret[k] = webapi.input(_unicode=False)[k]

    return ret
예제 #2
0
def getWebParaValue(*ks):
    ret={}
    wvs=webapi.input(_unicode=False)
    for k in ks:
        if(k in wvs):
            ret[k]=webapi.input(_unicode=False)[k]
            
    return ret
예제 #3
0
 def internal(*a, **kw):
     i = web.input(_method='get')
     if '_t' in i:
         try:
             t = background.threaddb[int(i._t)]
         except KeyError:
             return web.notfound()
         web._context[threading.currentThread()] = web._context[t]
         return
     else:
         return func(*a, **kw)
예제 #4
0
 def internal(*a, **kw):
     i = web.input(_method='get')
     if '_t' in i:
         try:
             t = background.threaddb[int(i._t)]
         except KeyError:
             return web.notfound()
         web._context[threading.currentThread()] = web._context[t]
         return
     else:
         return func(*a, **kw)
 def validates(self, source=None, _validate=True, **kw):
     source = source or kw or web.input()
     out = True
     for i in self.inputs:
         v = attrget(source, i.name)
         if _validate:
             out = i.validate(v) and out
         else:
             i.value = v
     if _validate:
         self.valid = out
     return out
예제 #6
0
def changequery(**kw):
    """
    Imagine you're at `/foo?a=1&b=2`. Then `changequery(a=3)` will return
    `/foo?a=3&b=2` -- the same URL but with the arguments you requested
    changed.
    """
    query = web.input(_method='get')
    for k, v in kw.iteritems():
        if v is None:
            query.pop(k, None)
        else:
            query[k] = v
    out = web.ctx.homepath + web.ctx.path
    if query:
        out += '?' + urllib.urlencode(query)
    return out
예제 #7
0
def changequery(**kw):
    """
    Imagine you're at `/foo?a=1&b=2`. Then `changequery(a=3)` will return
    `/foo?a=3&b=2` -- the same URL but with the arguments you requested
    changed.
    """
    query = web.input(_method='get')
    for k, v in kw.iteritems():
        if v is None:
            query.pop(k, None)
        else:
            query[k] = v
    out = web.ctx.homepath + web.ctx.path
    if query:
        out += '?' + urllib.urlencode(query)
    return out
예제 #8
0
파일: form.py 프로젝트: cigumo/webpy
    def validates(self, source=None, _validate=True, **kw):
        source = source or kw or web.input()
        out = True
        for i in self.inputs:
            if hasattr(i,'inputs'):
                for ii in i.inputs:
                    v = attrget(source, ii.name)
                    if _validate:
                        out = ii.validate(v) and out
                    else:
                        ii.set_value(v)
            else:
                v = attrget(source, i.name)
                if _validate:
                    out = i.validate(v) and out
                else:
                    i.set_value(v)

        if _validate:
            out = out and self._validate(source)
            self.valid = out
        return out