Exemplo n.º 1
0
 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())
Exemplo n.º 2
0
 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())
Exemplo n.º 3
0
 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())
Exemplo n.º 4
0
    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 ="******"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()
Exemplo n.º 5
0
    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 ='******'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()
Exemplo n.º 6
0
 def delete(self):
     for channel in Channel.get_all_by_target(self.target):
         channel.outlet = None
         channel.put()
     super(Outlet, self).delete()
Exemplo n.º 7
0
 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)
Exemplo n.º 8
0
 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)
Exemplo n.º 9
0
 def delete(self):
     for channel in Channel.get_all_by_target(self.target):
         channel.outlet = None
         channel.put()
     super(Outlet, self).delete()