当前位置: 首页>>代码示例>>Python>>正文


Python web.select函数代码示例

本文整理汇总了Python中web.select函数的典型用法代码示例。如果您正苦于以下问题:Python select函数的具体用法?Python select怎么用?Python select使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了select函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: select

 def select(self, cls, where=None, vars=None, order=None, group=None, 
            limit=None, offset=None):
     
     cls = self.get_cls_type(cls)
     if cls._pm_where_ is not None:
         where += " and " + cls._pm_where_
     
     self.syslog.debug("Select SQL:" + web.select(cls._pm_db_table_, 
                         vars=vars, 
                         where=where, 
                         limit=limit,
                         order=order,
                         offset=offset,
                         group=group, _test=True))
     
     results = web.select(cls._pm_db_table_, 
                         vars=vars, 
                         where=where, 
                         limit=limit,
                         order=order,
                         offset=offset,
                         group=group)
     #print results
     
     return self._mapping_to_model(cls, results)
开发者ID:dalinhuang,项目名称:demodemo,代码行数:25,代码来源:pm.py

示例2: testWrongQuery

 def testWrongQuery(self):
     # It should be possible to run a correct query after getting an error from a wrong query.
     try:
         web.select('wrong_table')
     except:
         pass
     web.select('person')
开发者ID:fidlej,项目名称:jakybyt,代码行数:7,代码来源:db.py

示例3: get

    def get(self, id, providerName):
        ret = {}
        id = self._getLocalId(id, providerName)[0].id
        for i in web.select('places_description', where='id=%s' % id):
            ret[i.name] = i.value

        ret['ESTADO_ZAUBER']  = web.select('places', what='state', where='id=%s' % id)[0].state
        return ret
开发者ID:jadulled,项目名称:inmuebles,代码行数:8,代码来源:webapp.py

示例4: get_revision

def get_revision(page_id, revision=None):
    if revision:
        try:
            revision = int(revision)
        except ValueError:
            return None
    if revision is not None:
        d = web.select('revisions', where='page_id=$page_id AND revision=$revision', limit=1, vars=locals())
    else:
        d = web.select('revisions', where='page_id=$page_id and revision > 0', order='revision DESC', limit=1, vars=locals())
    return (d and d[0]) or None
开发者ID:10sr,项目名称:jottit,代码行数:11,代码来源:db.py

示例5: GET

 def GET(self, comparison_name):
     """show a form to create a location"""
     if comparison_name == 'nomap':
         #showing a list of all locations withour a map
         events = web.select(tables='events', what='*', group='place', order='time_start', where='not cancelled and duplicateof is null and id_location is null' )
         print render.base(render.show_locations( events))
     elif comparison_name:
         #updating a specific location
         location = [l for l in web.select(tables='locations', where="comparison_name = '%s'" % comparison_name)]
         if len(location):
             print render.base(render.manage_location(location[0].longitude,location[0].latitude, location[0].originalmapurl, location[0].id, comparison_name))
         else:
             print render.base(render.manage_location(None, None, None, None, comparison_name))
     else:
         print "not implemented yet"
开发者ID:antoine,项目名称:metagenda,代码行数:15,代码来源:main.py

示例6: GET

 def GET(self, year):
     print render.year(
         G,
         year,
         web.select('shirts', 
             where='shirts.year = %s' % web.db.sqlify(year),
             order='college, variant'))
开发者ID:dsandler,项目名称:shirtdb,代码行数:7,代码来源:index.py

示例7: getperson

def getperson(id):
    person = web.select("people", where="id=%s" % web.sqlquote(id), limit=1)

    if person:
        return person[0]
    else:
        return None
开发者ID:drew,项目名称:seddit,代码行数:7,代码来源:people.py

示例8: getthread

def getthread(id):
    thread = web.select('threads', where='id=%s' % web.sqlquote(id), limit=1)
    
    if thread:
        return thread[0]
    else:
        return None
开发者ID:drew,项目名称:seddit,代码行数:7,代码来源:threads.py

示例9: view

 def view(self, found, model, providerName, id):
     lid = scrappers[providerName].local(id)
     comments = web.select('places_forum', where='idplace=%d' % lid, 
                          order='date asc')
     print render.header()
     print render.someplace(model, comments, providerName, id)
     print render.footer()
开发者ID:jadulled,项目名称:inmuebles,代码行数:7,代码来源:webapp.py

示例10: getuser

def getuser(email, password):
    """ return a user object if the email and passwords match an entry in the db.
    """
    user = web.select('people', where='email=%s and password=%s' % (web.sqlquote(email), web.sqlquote(password)), limit=1)
    if user:
        return user[0]
    else:
        return None
开发者ID:yudun1989,项目名称:blog,代码行数:8,代码来源:auth2.py

示例11: get_events

def get_events(**params):
    if not params.has_key("tables"):
        params["tables"] = "events left join locations on events.id_location = locations.id"
    if not params.has_key("what"):
        params[
            "what"
        ] = "events.*, locations.longitude as longitude, locations.latitude as latitude, locations.originalmapurl as mapurl, locations.id as loc_id"
    return web.select(**params)
开发者ID:antoine,项目名称:metagenda,代码行数:8,代码来源:db.py

示例12: find

def find(id):
    # TODO getthread has the same functionality. replace this with getthread.
    thread = web.select('threads', where='id=%s' % web.sqlquote(id), limit=1)
    
    if thread:
        return thread[0]
    else:
        return None
开发者ID:drew,项目名称:seddit,代码行数:8,代码来源:threads.py

示例13: guest

def guest():
    """ returns our default guest user for those that aren't logged in
    
        when you want to chat, you still need to create a new guest user, but just for
        browsing we'll use thi temp user. this allows use to program user names and id
        into the templates without having to worry about there not being a user present.
    """
    return web.select('people', where='email=%s' % web.sqlquote('[email protected]'))[0]
开发者ID:yudun1989,项目名称:blog,代码行数:8,代码来源:auth2.py

示例14: GET

 def GET(self, tag):
     bookmarks = []
     bs = list(web.select("bookmarks", order="created desc"))
     for b in bs:
         b.tags = b.tags.split()
         if tag in b.tags:
             bookmarks.append(b)
     empty = (len(bookmarks) == 0)
     web.render('search.html')
开发者ID:aviatorBeijing,项目名称:ptpy,代码行数:9,代码来源:lecker.py

示例15: select

    def select(cls, _test=False, **kwargs):
        """ Select and return multiple rows from the database via the web.py
            SQL-like query given via kwargs. For example:

            >>> print UserTest.select(where='username LIKE $u', vars={'u': 'jo%'}, order='username', limit=5, _test=True)
            SELECT * FROM users WHERE username LIKE 'jo%' ORDER BY username LIMIT 5
        """
        select = web.select(cls._table, _test=_test, **kwargs)
        return select if _test else [cls(row, _fromdb=True) for row in select]
开发者ID:benhoyt,项目名称:mro,代码行数:9,代码来源:mro.py


注:本文中的web.select函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。