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


Python Site.all方法代码示例

本文整理汇总了Python中models.Site.all方法的典型用法代码示例。如果您正苦于以下问题:Python Site.all方法的具体用法?Python Site.all怎么用?Python Site.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Site的用法示例。


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

示例1: RetriveSongsBySite

# 需要导入模块: from models import Site [as 别名]
# 或者: from models.Site import all [as 别名]
def RetriveSongsBySite(site_name):    
    #if you dont pass anything in it gets all the sites
    if site_name == '':
        site = Site.all().fetch(150)
    else:
        site = Site.all().filter('name =', site_name).fetch(1)
        
    return site
开发者ID:BenjaminDavison,项目名称:machinehype-gae,代码行数:10,代码来源:controllers.py

示例2: get

# 需要导入模块: from models import Site [as 别名]
# 或者: from models.Site import all [as 别名]
    def get(self):

        sites = Site.all()

        context = {
            'sites': sites,
        }

        sites_for_output = {}
    
        # loop over the sites
        for site in sites:
            # and store each one in the output variable
            site_for_output = {
                "url": site.url,
                "issues": site.issue_set.count(),
            }
            sites_for_output[site.name] = site_for_output
    
        # create the JSON object we're going to return
        json = simplejson.dumps(sites_for_output, sort_keys=False)

        # serve the response with the correct content type
        #self.response.headers['Content-Type'] = 'application/json'
        # write the json to the response
        self.response.out.write(json)
开发者ID:4sp1r3,项目名称:fixmysite,代码行数:28,代码来源:main.py

示例3: get

# 需要导入模块: from models import Site [as 别名]
# 或者: from models.Site import all [as 别名]
    def get(self):
        "Ping each site in turn and record the response"
        # get all the sites we're going to ping
        sites = Site.all()

        # loop over all of the current sites
        for site in sites:
            # ping each site
            ping_site(site)

        self.redirect("/")
开发者ID:rootart,项目名称:appengine-uptime,代码行数:13,代码来源:main.py

示例4: observation_update_all

# 需要导入模块: from models import Site [as 别名]
# 或者: from models.Site import all [as 别名]
def observation_update_all():

    sites = Site.all().fetch(limit = 200)
    for site in sites:
        taskqueue.add(url = "/admin/sites/%s/observation/update" % site.key().id_or_name(), queue_name="update")
        taskqueue.add(url = "/admin/sites/%s/observation/update2" % site.key().id_or_name(), queue_name="update")

    if request.args.get("redirect"):
        flash("Started update observation tasks for all sites")
        return redirect(url_for('sites'))

    return Response(status = 204)
开发者ID:tempredirect,项目名称:MetOfficeWatch,代码行数:14,代码来源:views.py

示例5: post

# 需要导入模块: from models import Site [as 别名]
# 或者: from models.Site import all [as 别名]
 def post(self):
     site_name = self.request.get('site_name')
     
     #this is dodgy, I would rather do something like Site.get(name=site_name) but I can't get that
     #to work...
     p = Site.all().filter('name =', site_name).fetch(1)
     
     if users.get_current_user():
         Song(site = p[0],
              title = self.request.get('title'),
              mp3_url = self.request.get('mp3_url'),
              likes = 0).put()
              
         self.redirect('/?' + urllib.urlencode({'site_name': p[0].name}))
开发者ID:BenjaminDavison,项目名称:machinehype-gae,代码行数:16,代码来源:controllers.py

示例6: post

# 需要导入模块: from models import Site [as 别名]
# 或者: from models.Site import all [as 别名]
    def post(self):
        
        """
        site = Site(
            name = 'name',
            url = 'http://url.com',            
            slug = 'slug',
        )
        site.put()
        
        issue = Issue(
            title = 'title',
            description = 'description',
            site = site,
        )
        issue.put()
        """

        # get url and then decide if we have a site already or
        # need to create one
        
        
        
        name = self.request.get("name")
        url = self.request.get("url")
        
        try:
            site = Site.gql("WHERE url=:1", url)[0]
        except IndexError:
            
            """
            import sys
            import pdb
            for attr in ('stdin', 'stdout', 'stderr'):
                setattr(sys, attr, getattr(sys, '__%s__' % attr))
            pdb.set_trace()
            """
            
            site = Site(
                name = name,
                url = url,            
                slug = slugify(name),
            )
            site.put()

        title = self.request.get("title")
        description = self.request.get("description")

        issue = Issue(
            title = title,
            description = description,
            site = site,
        )
        issue.put()


        context = {
            'issue': issue,
            'sites': Site.all(),
        }

        # prepare the context for the template
        # calculate the template path
        path = os.path.join(os.path.dirname(__file__), 'templates',
            'index.html')
        # render the template with the provided context
        self.response.out.write(template.render(path, context))
开发者ID:4sp1r3,项目名称:fixmysite,代码行数:69,代码来源:main.py

示例7: sites

# 需要导入模块: from models import Site [as 别名]
# 或者: from models.Site import all [as 别名]
def sites():
    return json_list_response(Site.all().fetch(limit = 200))
开发者ID:tempredirect,项目名称:MetOfficeWatch,代码行数:4,代码来源:sites.py

示例8: findSite

# 需要导入模块: from models import Site [as 别名]
# 或者: from models.Site import all [as 别名]
'''
Created on Feb 23, 2011

@author: jackdreilly
'''
from models import Site

qlsites = Site.all().fetch(100)

    
def findSite(url,type):
	return [site for site in qlsites if site.name in url and site.type == type][0]
开发者ID:jackdreilly,项目名称:quiklyrics,代码行数:14,代码来源:qlsite.py

示例9: sites

# 需要导入模块: from models import Site [as 别名]
# 或者: from models.Site import all [as 别名]
def sites():
    return render_template("sites.html", sites = Site.all().fetch(limit = 200))
开发者ID:tempredirect,项目名称:MetOfficeWatch,代码行数:4,代码来源:views.py


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