當前位置: 首頁>>代碼示例>>Python>>正文


Python Channel.get_all_by_target方法代碼示例

本文整理匯總了Python中models.Channel.get_all_by_target方法的典型用法代碼示例。如果您正苦於以下問題:Python Channel.get_all_by_target方法的具體用法?Python Channel.get_all_by_target怎麽用?Python Channel.get_all_by_target使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.Channel的用法示例。


在下文中一共展示了Channel.get_all_by_target方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get

# 需要導入模塊: from models import Channel [as 別名]
# 或者: from models.Channel import get_all_by_target [as 別名]
 def get(self):
     outlets = Outlet.all().filter('target =', self.account).fetch(100)
     if len(self.request.path.split('/')) > 2:
         source = Account.get_by_hash(self.request.path.split('/')[-1])
         channel = Channel.get_by_source_and_target(source, self.account)
         self.render('templates/source.html', locals())
     else:
         enabled_channels = Channel.get_all_by_target(self.account).order('-count').filter('status =', 'enabled')
         self.render('templates/sources.html', locals())
開發者ID:dcparker,項目名稱:notify-io,代碼行數:11,代碼來源:main.py

示例2: get

# 需要導入模塊: from models import Channel [as 別名]
# 或者: from models.Channel import get_all_by_target [as 別名]
 def get(self):
     outlets = Outlet.all().filter("target =", self.account).fetch(100)
     if len(self.request.path.split("/")) > 2:
         source = Account.get_by_hash(self.request.path.split("/")[-1])
         channel = Channel.get_by_source_and_target(source, self.account)
         self.render("templates/source.html", locals())
     else:
         enabled_channels = Channel.get_all_by_target(self.account).order("-count").filter("status =", "enabled")
         # TODO: remove me after a while. this is to fix my poor reference management
         for c in enabled_channels:
             try:
                 c.outlet
             except:
                 c.outlet = None
                 c.put()
         self.render("templates/sources.html", locals())
開發者ID:Mondego,項目名稱:pyreco,代碼行數:18,代碼來源:allPythonContent.py

示例3: initialize

# 需要導入模塊: from models import Channel [as 別名]
# 或者: from models.Channel import get_all_by_target [as 別名]
    def initialize(self, request, response):
        super(RequestHandler, self).initialize(request, response)
        self.user = users.get_current_user()
        if self.user:
            self.login_url = None
            self.logout_url = users.create_logout_url("/")
            self.account = Account.all().filter("user =", self.user).get()
            if not self.account:
                # Set up a Notify.io account

                self.account = Account()
                self.account.set_hash_and_key()
                # self.account.source_name = self.user.nick() # More useful default than None
                self.account.put()

                # Create default Desktop Notifier
                o = Outlet(target=self.account, type_name="DesktopNotifier")
                o.set_name("Default Desktop Notifier")
                o.put()

            # This is to update existing accounts before outlets
            if not self.account.get_default_outlet():
                # Create default Desktop Notifier
                o = Outlet(target=self.account, type_name="DesktopNotifier")
                o.set_name("Default Desktop Notifier")
                o.put()
                for channel in Channel.get_all_by_target(self.account):
                    if not channel.outlet:
                        channel.outlet = o
                        channel.put()

        else:
            self.logout_url = None
            self.account = None
            self.login_url = users.create_login_url(request.path)

        # Hide the Get Started tip
        if request.query_string == "hide":
            self.account.started = True
            self.account.put()
開發者ID:Mondego,項目名稱:pyreco,代碼行數:42,代碼來源:allPythonContent.py

示例4: delete

# 需要導入模塊: from models import Channel [as 別名]
# 或者: from models.Channel import get_all_by_target [as 別名]
 def delete(self):
     for channel in Channel.get_all_by_target(self.target):
         channel.outlet = None
         channel.put()
     super(Outlet, self).delete()
開發者ID:Mondego,項目名稱:pyreco,代碼行數:7,代碼來源:allPythonContent.py

示例5: render

# 需要導入模塊: from models import Channel [as 別名]
# 或者: from models.Channel import get_all_by_target [as 別名]
 def render(self, template_path, locals):
     locals["pending_channels"] = Channel.get_all_by_target(self.account).filter("status =", "pending").fetch(10)
     locals["recent_notifications"] = Notification.get_history_by_target(self.account).fetch(3)
     super(DashboardHandler, self).render(template_path, locals)
開發者ID:Mondego,項目名稱:pyreco,代碼行數:6,代碼來源:allPythonContent.py


注:本文中的models.Channel.get_all_by_target方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。