コード例 #1
0
ファイル: main.py プロジェクト: jtremback/LigerTail
    def get(self, url):
        BaseHandler.initFromRequest(self, self.request)
        if not url or len(url) < 1:
            return
        
        #if len(url) > 0:
        #    path = os.path.join(os.path.dirname(__file__), 'web', url)
        #else:
        publisherUrl = self.request.host + "/wiki/" + url
        if publisherUrl[-1] != "/":
            publisherUrl += "/"
        #publisherUrl = publisherUrl.lower()
        items = BaseHandler.getOrderedItems(self,
                                            publisherUrl,
                                            model.getDefaultFilter()) #NO_VIEWER self.viewer.filter)

        #publisherLinks = model.getItems(publisherUrl)
        if len(items) < 1:
            self.copyWikiLinks(url)
            
        path = os.path.join(os.path.dirname(__file__), 'web', 'wiki_template.html')
        out = ''
        try:
          out = template.render(path, {})
          self.response.headers["Access-Control-Allow-Origin"] = '*'
        except Exception:
          logging.warning('createWikiHandler: %s' % sys.exc_info()[1])
          out = ''
        self.response.out.write(out)
コード例 #2
0
ファイル: main.py プロジェクト: jtremback/LigerTail
 def post(self):
   try:
     BaseHandler.initFromRequest(self, self.request)
     orderedItems = BaseHandler.getOrderedItems(self,
                                                self.getParam('publisherUrl'),
                                                model.getDefaultFilter())
     self.common_response.setItems(orderedItems, response.ItemInfo.SHORT)
   except Exception:
     BaseHandler.logException(self)
   BaseHandler.writeResponse(self)
コード例 #3
0
ファイル: main.py プロジェクト: jtremback/LigerTail
 def post(self):
   try:
     BaseHandler.initFromRequest(self, self.request)
     orderedItems = BaseHandler.getOrderedItems(self,
                                                self.getParam('publisherUrl'),
                                                model.getDefaultFilter()) 
     if self.client.numItems < len(orderedItems):
       orderedItems = orderedItems[0: self.client.numItems]
     self.common_response.setItems(orderedItems, response.ItemInfo.WITH_PRICE)
     if self.client.numItems - len(orderedItems) > 0:
       BaseHandler.setDefaultItems(self, self.client.numItems - len(orderedItems))
   except Exception:
     BaseHandler.logException(self)
   BaseHandler.writeResponse(self)