Loading opds_catalog/dl.py +6 −1 Original line number Diff line number Diff line Loading @@ -32,6 +32,8 @@ def Download(request, book_id, zip_flag): else: transname=utils.translit(book.filename) transname = utils.to_ascii(transname) if zip_flag == 1: dlfilename=transname+'.zip' content_type='application/zip' Loading Loading @@ -155,6 +157,9 @@ def ConvertFB2(request, book_id, convert_type): transname=utils.translit(book.title+'.'+book.format) else: transname=utils.translit(book.filename) transname = utils.to_ascii(transname) (n,e)=os.path.splitext(transname) dlfilename="%s.%s"%(n,convert_type) Loading opds_catalog/models.py +0 −4 Original line number Diff line number Diff line Loading @@ -84,10 +84,6 @@ class Genre(models.Model): class bgenre(models.Model): book = models.ForeignKey('Book', db_index=True) genre = models.ForeignKey('Genre', db_index=True) # class Meta: # index_together = [ # ["book", "genre"], # ] class Series(models.Model): ser = models.CharField(max_length=SIZE_SERIES, db_index=True) Loading opds_catalog/utils.py +6 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ # # Вспомогательные функции # import unicodedata def translit(s): """Russian translit: converts 'привет'->'privet'""" assert s is not str, "Error: argument MUST be string" Loading @@ -13,3 +15,6 @@ def translit(s): for k in table2.keys(): s = s.replace(k,table2[k]) return s def to_ascii(s): return s.encode('ascii', 'replace').decode('utf-8') No newline at end of file Loading
opds_catalog/dl.py +6 −1 Original line number Diff line number Diff line Loading @@ -32,6 +32,8 @@ def Download(request, book_id, zip_flag): else: transname=utils.translit(book.filename) transname = utils.to_ascii(transname) if zip_flag == 1: dlfilename=transname+'.zip' content_type='application/zip' Loading Loading @@ -155,6 +157,9 @@ def ConvertFB2(request, book_id, convert_type): transname=utils.translit(book.title+'.'+book.format) else: transname=utils.translit(book.filename) transname = utils.to_ascii(transname) (n,e)=os.path.splitext(transname) dlfilename="%s.%s"%(n,convert_type) Loading
opds_catalog/models.py +0 −4 Original line number Diff line number Diff line Loading @@ -84,10 +84,6 @@ class Genre(models.Model): class bgenre(models.Model): book = models.ForeignKey('Book', db_index=True) genre = models.ForeignKey('Genre', db_index=True) # class Meta: # index_together = [ # ["book", "genre"], # ] class Series(models.Model): ser = models.CharField(max_length=SIZE_SERIES, db_index=True) Loading
opds_catalog/utils.py +6 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ # # Вспомогательные функции # import unicodedata def translit(s): """Russian translit: converts 'привет'->'privet'""" assert s is not str, "Error: argument MUST be string" Loading @@ -13,3 +15,6 @@ def translit(s): for k in table2.keys(): s = s.replace(k,table2[k]) return s def to_ascii(s): return s.encode('ascii', 'replace').decode('utf-8') No newline at end of file