Ejemplo n.º 1
0
    def _get_default(self, par):

        obj = {}
        obj['images'] = Image.all().order("-date").fetch(20)
        obj['groups'] = Group.all()

        self._respond(par, obj)
Ejemplo n.º 2
0
    def get(self, par):

        # all blog and static pages are cacheable
        if self._check_get_from_cache():
            return True

        self.widgets = Widgets(self, self._conf)

        # get the groups
        self._obj['groups'] = Group.all()

        routes = [
            # {"r": self._conf.BLOG + "/widget/(.*)",  "f": self._get_widget},
            {"r": "/rssfeed(.*)",                      "f": self._force_rss},
            {"r": self._conf.BLOG + "/search\?q=(.*)", "f": self._get_blog_search},
            {"r": self._conf.BLOG + "/(.*)/(.*)\?",    "f": self._get_blog_single},
            {"r": self._conf.BLOG + "/(.*)/(.*)",      "f": self._get_blog_single},
            {"r": self._conf.BLOG + "/(.*)\?",         "f": self._get_blog_group},
            {"r": self._conf.BLOG + "/(.*)",           "f": self._get_blog_group},
            {"r": self._conf.BLOG + ".*",              "f": self._get_blog},
            {"r": "/(.*)\?",                           "f": self._get_static},
            {"r": "/(.*)",                             "f": self._get_static}
        ]
            
        if self._req.route(routes):
            # cache the return url        
            self._req.sesh().set_return_url(self._req.spath())
            self._req.sesh().save();
            return True
        
        return False
Ejemplo n.º 3
0
    def get(self, par):

        # all blog and static pages are cacheable
        if self._check_get_from_cache():
            return True

        self.widgets = Widgets(self, self._conf)

        # TODO filterise this some umbraco url specific tidying
        # if self._req.ext() == 'aspx':
        #     return self._aspx_redirect()

        # self._req.remove_par("c")
        # self._req.remove_par("C")

        # get the groups
        self._obj['groups'] = Group.all()

        routes = [
            # {"r": self._conf.BLOG + "/widget/(.*)",  "f": self._get_widget},
            {"r": "/rssfeed(.*)",                     "f": self._force_rss},
            {"r": self._conf.BLOG + "/(.*)/(.*)\?",    "f": self._get_blog_single},
            {"r": self._conf.BLOG + "/(.*)/(.*)",      "f": self._get_blog_single},
            {"r": self._conf.BLOG + "/(.*)\?",         "f": self._get_blog_group},
            {"r": self._conf.BLOG + "/(.*)",           "f": self._get_blog_group},
            {"r": self._conf.BLOG + ".*",              "f": self._get_blog},
            {"r": "/(.*)\?",                          "f": self._get_static},
            {"r": "/(.*)",                            "f": self._get_static}
        ]
            
        if self._req.route(routes):
            # cache the return url        
            self._req.sesh().set_return_url(self._req.spath())
            self._req.sesh().save();
            return True
        
        return False