Exemple #1
0
 def getChild(self, path, request):
     try:
         paste = Paste.findByName(self._store, path.decode('ascii'))
     except ItemNotFound:
         return NoResource('No such paste')
     else:
         return Data(paste.toJSON(), 'application/json')
Exemple #2
0
 def getChild(self, path, request):
     try:
         paste = Paste.findByName(self.store, path.decode('ascii'))
     except ItemNotFound:
         return NoResource('No such paste')
     else:
         return Data(paste.content.encode('utf-8'), 'text/plain; charset=UTF-8')
Exemple #3
0
 def getChild(self, path, request):
     try:
         paste = Paste.findByName(self._store, path.decode('ascii'))
     except ItemNotFound:
         return NoResource('No such paste')
     else:
         return Data(paste.toJSON(), 'application/json')
Exemple #4
0
 def getChild(self, path, request):
     try:
         paste = Paste.findByName(self.store, path.decode('ascii'))
     except ItemNotFound:
         return NoResource('No such paste')
     else:
         return Data(paste.content.encode('utf-8'),
                     'text/plain; charset=UTF-8')
Exemple #5
0
 def _createPaste(self, content, languageHint=None):
     p = Paste(store=self._store,
               name=self._generateName(),
               content=content,
               languageHint=languageHint)
     # <k4y> so what's a good paste lifetime?
     # * mithrandi picks "6 days" out of a musical hat
     # <k4y> what's it playing?
     # <mithrandi> DJ Shadow - Six Days
     expiryDate = p.created + timedelta(days=6)
     self._scheduler.schedule(p, expiryDate)
     return p