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


Python Link.put方法代码示例

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


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

示例1: post

# 需要导入模块: from model import Link [as 别名]
# 或者: from model.Link import put [as 别名]
    def post(self):
        t_values = {}
        current_link_id = self.request.POST['current_link_id']
        link_title = self.request.POST['link_title']
        link_target = self.request.POST['link_target']
        link_sequence = self.request.POST['link_sequence']
        logging.info("LinkManager post: current_link_id = %s, link_title = %s, link_target = %s, link_sequence = %s" % (current_link_id, link_title, 'link_target', 'link_sequence'))

        if current_link_id:
            # edit existed link
            link = Link.get_by_id(long(current_link_id))
            link.title = link_title
            link.target = link_target
            link.sequence = long(link_sequence)
            link.put()
            t_values['alert_message'] = "link %s has been updated" % (link.title)
        else:
            # create new link
            link = Link(title=link_title, target=link_target, sequence=long(link_sequence))
            link.put()
            t_values['alert_message'] = "link %s has been added" % (link.title)

        # find all links
        links = Link.all().order("-date")
        t_values["links"] = links
        return self.response.out.write(render_template("links.html", t_values, "", True))
开发者ID:loongw,项目名称:another-gae-blog,代码行数:28,代码来源:admin.py

示例2: post

# 需要导入模块: from model import Link [as 别名]
# 或者: from model.Link import put [as 别名]
 def post(self):
     action = self.param('action')
     name,url = (self.request.get(item) for item in ('linkName', 'linkURL'))
     if(action == 'edit'):
         key = self.param('id')
         link = Link.get_by_id(int(key))
         link.linkName = name
         link.linkURL = url
     else:
         link = Link(linkName=name,linkURL=url)
     link.put()
     self.redirect('/admin/links')   
     return  
开发者ID:sunruijia,项目名称:simblog,代码行数:15,代码来源:blog.py

示例3: save_link

# 需要导入模块: from model import Link [as 别名]
# 或者: from model.Link import put [as 别名]
 def save_link(cls, title, url, body="", tags=[], clicks=0, unread=True):
     url = norm(url)
     id = mmh3.hash(url)
     key = ndb.Key(LinkModel, id)
     domain = urlparse(url).netloc
     if len(domain)>4 and domain.startswith('www.'):
         domain = domain[4:]
     link = LinkModel( key = key,
                       title = title,
                       url = url,
                       domain = domain,
                       body = body,
                       tags = tags,
                       clicks = clicks,
                       unread = unread )
     link.put()
     id = str(link.id)
     doc = cls._buildDoc(id, title, body, domain, tags)
     cls.add(doc)
     return cls(doc, link)
开发者ID:yiransheng,项目名称:yiransbookmark,代码行数:22,代码来源:docs.py

示例4: get

# 需要导入模块: from model import Link [as 别名]
# 或者: from model.Link import put [as 别名]
    def get(self):
        link = Link(title="linkx1", target="http://baidu.com", sequence=9)
        link.put()

        link = Link(title="linkx2", target="http://baidu.com", sequence=9)
        link.put()

        link = Link(title="linkx3", target="http://baidu.com", sequence=9)
        link.put()
        return self.response.out.write(render_template("index.html", {}, "basic", False))
开发者ID:loongw,项目名称:another-gae-blog,代码行数:12,代码来源:weblog.py


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