Example #1
0
    def titlelist(self, **args):
        self.common()
        self._titlelisttemplate.titles = []
        try:
            if type(args['titles']) == type("string"):
                self._titlelisttemplate.titles.append(Title.get(
                    args['titles']))
            else:
                for id in args['titles']:
                    self._titlelisttemplate.titles.append(Title.get(id))
        except KeyError:
            pass

        try:
            if (args['delete']):
                #delete the titles
                for title in self._titlelisttemplate.titles:
                    #                    for author in title.author:
                    #                        Author.delete(author.id)
                    for book in title.books:
                        Book.delete(book.id)
                    for category in title.categorys:
                        Category.delete(category.id)

                    Title.delete(title.id)

            #and back to the search
                from cherrypy.lib import httptools
                httptools.redirect(cherrypy.session['lastsearch'])
        except:
            return self._titlelisttemplate.respond()
Example #2
0
    def titlelist(self,**args):
        self.common()
        self._titlelisttemplate.titles=[]
        try:
            if type(args['titles']) == type("string"):
                self._titlelisttemplate.titles.append(Title.get(args['titles']))
            else:
                for id in args['titles']:
                    self._titlelisttemplate.titles.append(Title.get(id))
        except KeyError:
            pass

        try: 
            if (args['delete']):
            #delete the titles
                for title in self._titlelisttemplate.titles:
#                    for author in title.author:
#                        Author.delete(author.id)
                    for book in title.books:
                        Book.delete(book.id)
                    for category in title.categorys:
                        Category.delete(category.id)
                    
                    Title.delete(title.id)

            #and back to the search
                from cherrypy.lib import httptools
                httptools.redirect(cherrypy.session['lastsearch'])	
        except:
            return self._titlelisttemplate.respond()
Example #3
0
 def wrapper(*args, **kwargs):
     if len(cherrypy.request.path) > 1:
         if not slash and cherrypy.request.path[-1] == "/":
             httptools.redirect(cherrypy.request.path[:-1])
         elif slash and cherrypy.request.path[-1] != "/":
             httptools.redirect(cherrypy.request.path + "/")
         else:
             return func(*args, **kwargs)
     else:
         return func(*args, **kwargs)
Example #4
0
 def resume(self, *args, **kwargs):
     global scanflag
     f = kwargs['f']
     os.rename(os.path.join(config['paused_torrent_dir'], urllib.unquote_plus(f)), os.path.join(config['torrent_dir'], urllib.unquote_plus(f)))
     scanflag = True
     time.sleep(2)
     return httptools.redirect("/")
Example #5
0
 def addfile(self, *args, **kwargs):
     global scanflag
     outf = open(os.path.join(config['torrent_dir'], urllib.unquote_plus(cpg.request.filenameMap['thefile'])), 'wb')
     outf.write(kwargs['thefile'])
     outf.close()
     scanflag = True
     time.sleep(2)
     return httptools.redirect("/")
Example #6
0
 def addhttp(self, *args, **kwargs):
     global scanflag
     filename = kwargs['url'].split('/')[-1]
     inf = urllib.urlopen(kwargs['url'])
     outf = open(os.path.join(config['torrent_dir'], urllib.unquote_plus(filename)), 'wb')
     outf.write(inf.read())
     outf.close()
     inf.close()
     scanflag = True
     time.sleep(2)
     return httptools.redirect("/")
Example #7
0
 def logout(self, *args, **kwargs):
     del cpg.request.sessionMap['authenticated']
     return httptools.redirect("/")
Example #8
0
 def login(self, *args, **kwargs):
     return httptools.redirect("/")