Loading opds_catalog/__pycache__/feeds.cpython-35.pyc +12 B (38.3 KiB) File changed.No diff preview for this file type. View original file View changed file opds_catalog/__pycache__/settings.cpython-35.pyc +193 B (2.66 KiB) File changed.No diff preview for this file type. View original file View changed file opds_catalog/feeds.py +13 −14 Original line number Diff line number Diff line Loading @@ -379,8 +379,7 @@ class SearchBooksFeed(AuthFeed): elif searchtype == 'u': if settings.AUTH: books = Book.objects\ .filter(bookshelf__user=self.request.user)\ .order_by('-readtime') .filter(bookshelf__user=self.request.user) else: books={} Loading Loading @@ -720,16 +719,16 @@ class BooksFeed(AuthFeed): def items(self, obj): length, chars = obj if self.lang_code: sql="""select upper(substr(title,1,%(length)s)) as id, count(*) as cnt sql="""select upper(substring(title,1,%(length)s)) as id, count(*) as cnt from opds_catalog_book where lang_code=%(lang_code)s and upper(title) like '%(chars)s%%' group by upper(substr(title,1,%(length)s)) group by upper(substring(title,1,%(length)s)) order by id"""%{'length':length, 'lang_code':self.lang_code, 'chars':chars} else: sql="""select upper(substr(title,1,%(length)s)) as id, count(*) as cnt sql="""select upper(substring(title,1,%(length)s)) as id, count(*) as cnt from opds_catalog_book where upper(title) like '%(chars)s%%' group by upper(substr(title,1,%(length)s)) group by upper(substring(title,1,%(length)s)) order by id"""%{'length':length,'chars':chars} dataset = Book.objects.raw(sql) Loading Loading @@ -777,16 +776,16 @@ class AuthorsFeed(AuthFeed): def items(self, obj): length, chars = obj if self.lang_code: sql="""select upper(substr(last_name || ' ' || first_name,1,%(length)s)) as id, count(*) as cnt sql="""select upper(substring(last_name || ' ' || first_name,1,%(length)s)) as id, count(*) as cnt from opds_catalog_author where lang_code=%(lang_code)s and upper(last_name || ' ' || first_name) like '%(chars)s%%' group by upper(substr(last_name || ' ' || first_name,1,%(length)s)) group by upper(substring(last_name || ' ' || first_name,1,%(length)s)) order by id"""%{'length':length, 'lang_code':self.lang_code, 'chars':chars} else: sql="""select upper(substr(last_name || ' ' || first_name,1,%(length)s)) as id, count(*) as cnt sql="""select upper(substring(last_name || ' ' || first_name,1,%(length)s)) as id, count(*) as cnt from opds_catalog_author where upper(last_name || ' ' || first_name) like '%(chars)s%%' group by upper(substr(last_name || ' ' || first_name,1,%(length)s)) group by upper(substring(last_name || ' ' || first_name,1,%(length)s)) order by id"""%{'length':length,'chars':chars} dataset = Author.objects.raw(sql) Loading Loading @@ -834,16 +833,16 @@ class SeriesFeed(AuthFeed): def items(self, obj): length, chars = obj if self.lang_code: sql="""select upper(substr(ser,1,%(length)s)) as id, count(*) as cnt sql="""select upper(substring(ser,1,%(length)s)) as id, count(*) as cnt from opds_catalog_series where lang_code=%(lang_code)s and upper(ser) like '%(chars)s%%' group by upper(substr(ser,1,%(length)s)) group by upper(substring(ser,1,%(length)s)) order by id"""%{'length':length, 'lang_code':self.lang_code, 'chars':chars} else: sql="""select upper(substr(ser,1,%(length)s)) as id, count(*) as cnt sql="""select upper(substring(ser,1,%(length)s)) as id, count(*) as cnt from opds_catalog_series where upper(ser) like '%(chars)s%%' group by upper(substr(ser,1,%(length)s)) group by upper(substring(ser,1,%(length)s)) order by id"""%{'length':length,'chars':chars} dataset = Series.objects.raw(sql) Loading opds_catalog/settings.py +5 −4 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ ZIPSCAN = getattr(settings, "SOPDS_ZIPSCAN", True) ZIPRESCAN = getattr(settings, "SOPDS_ZIPRESCAN", False) ZIPCODEPAGE = getattr(settings, "SOPDS_ZIPCODEPAGE", "cp866") DELETE_LOGICAL = getattr(settings, "SOPDS_DELETE_LOGICAL", False) SPLITITEMS = getattr(settings, "SOPDS_SPLITITEMKS", 300) SPLITITEMS = getattr(settings, "SOPDS_SPLITITEMS", 300) FB2TOEPUB = getattr(settings, "SOPDS_FB2TOEPUB", "") FB2TOMOBI = getattr(settings, "SOPDS_FB2TOMOBI", "") TEMP_DIR = getattr(settings, "SOPDS_TEMP_DIR", "/tmp") Loading Loading @@ -49,11 +49,12 @@ from django.dispatch import receiver def sopds_upper(s): return s.upper() #def sopds_substring(s,i,l): # return s[i:i+l] def sopds_substring(s,i,l): i = i - 1 return s[i:i+l] @receiver(connection_created) def extend_sqlite(connection=None, **kwargs): if connection.vendor == "sqlite": connection.connection.create_function('upper',1,sopds_upper) # connection.connection.create_function('substring',3,sopds_substring) connection.connection.create_function('substring',3,sopds_substring) sopds/__pycache__/settings.cpython-35.pyc +1 B (2.8 KiB) File changed.No diff preview for this file type. View original file View changed file Loading
opds_catalog/__pycache__/feeds.cpython-35.pyc +12 B (38.3 KiB) File changed.No diff preview for this file type. View original file View changed file
opds_catalog/__pycache__/settings.cpython-35.pyc +193 B (2.66 KiB) File changed.No diff preview for this file type. View original file View changed file
opds_catalog/feeds.py +13 −14 Original line number Diff line number Diff line Loading @@ -379,8 +379,7 @@ class SearchBooksFeed(AuthFeed): elif searchtype == 'u': if settings.AUTH: books = Book.objects\ .filter(bookshelf__user=self.request.user)\ .order_by('-readtime') .filter(bookshelf__user=self.request.user) else: books={} Loading Loading @@ -720,16 +719,16 @@ class BooksFeed(AuthFeed): def items(self, obj): length, chars = obj if self.lang_code: sql="""select upper(substr(title,1,%(length)s)) as id, count(*) as cnt sql="""select upper(substring(title,1,%(length)s)) as id, count(*) as cnt from opds_catalog_book where lang_code=%(lang_code)s and upper(title) like '%(chars)s%%' group by upper(substr(title,1,%(length)s)) group by upper(substring(title,1,%(length)s)) order by id"""%{'length':length, 'lang_code':self.lang_code, 'chars':chars} else: sql="""select upper(substr(title,1,%(length)s)) as id, count(*) as cnt sql="""select upper(substring(title,1,%(length)s)) as id, count(*) as cnt from opds_catalog_book where upper(title) like '%(chars)s%%' group by upper(substr(title,1,%(length)s)) group by upper(substring(title,1,%(length)s)) order by id"""%{'length':length,'chars':chars} dataset = Book.objects.raw(sql) Loading Loading @@ -777,16 +776,16 @@ class AuthorsFeed(AuthFeed): def items(self, obj): length, chars = obj if self.lang_code: sql="""select upper(substr(last_name || ' ' || first_name,1,%(length)s)) as id, count(*) as cnt sql="""select upper(substring(last_name || ' ' || first_name,1,%(length)s)) as id, count(*) as cnt from opds_catalog_author where lang_code=%(lang_code)s and upper(last_name || ' ' || first_name) like '%(chars)s%%' group by upper(substr(last_name || ' ' || first_name,1,%(length)s)) group by upper(substring(last_name || ' ' || first_name,1,%(length)s)) order by id"""%{'length':length, 'lang_code':self.lang_code, 'chars':chars} else: sql="""select upper(substr(last_name || ' ' || first_name,1,%(length)s)) as id, count(*) as cnt sql="""select upper(substring(last_name || ' ' || first_name,1,%(length)s)) as id, count(*) as cnt from opds_catalog_author where upper(last_name || ' ' || first_name) like '%(chars)s%%' group by upper(substr(last_name || ' ' || first_name,1,%(length)s)) group by upper(substring(last_name || ' ' || first_name,1,%(length)s)) order by id"""%{'length':length,'chars':chars} dataset = Author.objects.raw(sql) Loading Loading @@ -834,16 +833,16 @@ class SeriesFeed(AuthFeed): def items(self, obj): length, chars = obj if self.lang_code: sql="""select upper(substr(ser,1,%(length)s)) as id, count(*) as cnt sql="""select upper(substring(ser,1,%(length)s)) as id, count(*) as cnt from opds_catalog_series where lang_code=%(lang_code)s and upper(ser) like '%(chars)s%%' group by upper(substr(ser,1,%(length)s)) group by upper(substring(ser,1,%(length)s)) order by id"""%{'length':length, 'lang_code':self.lang_code, 'chars':chars} else: sql="""select upper(substr(ser,1,%(length)s)) as id, count(*) as cnt sql="""select upper(substring(ser,1,%(length)s)) as id, count(*) as cnt from opds_catalog_series where upper(ser) like '%(chars)s%%' group by upper(substr(ser,1,%(length)s)) group by upper(substring(ser,1,%(length)s)) order by id"""%{'length':length,'chars':chars} dataset = Series.objects.raw(sql) Loading
opds_catalog/settings.py +5 −4 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ ZIPSCAN = getattr(settings, "SOPDS_ZIPSCAN", True) ZIPRESCAN = getattr(settings, "SOPDS_ZIPRESCAN", False) ZIPCODEPAGE = getattr(settings, "SOPDS_ZIPCODEPAGE", "cp866") DELETE_LOGICAL = getattr(settings, "SOPDS_DELETE_LOGICAL", False) SPLITITEMS = getattr(settings, "SOPDS_SPLITITEMKS", 300) SPLITITEMS = getattr(settings, "SOPDS_SPLITITEMS", 300) FB2TOEPUB = getattr(settings, "SOPDS_FB2TOEPUB", "") FB2TOMOBI = getattr(settings, "SOPDS_FB2TOMOBI", "") TEMP_DIR = getattr(settings, "SOPDS_TEMP_DIR", "/tmp") Loading Loading @@ -49,11 +49,12 @@ from django.dispatch import receiver def sopds_upper(s): return s.upper() #def sopds_substring(s,i,l): # return s[i:i+l] def sopds_substring(s,i,l): i = i - 1 return s[i:i+l] @receiver(connection_created) def extend_sqlite(connection=None, **kwargs): if connection.vendor == "sqlite": connection.connection.create_function('upper',1,sopds_upper) # connection.connection.create_function('substring',3,sopds_substring) connection.connection.create_function('substring',3,sopds_substring)
sopds/__pycache__/settings.cpython-35.pyc +1 B (2.8 KiB) File changed.No diff preview for this file type. View original file View changed file