stop using buitins as global

diagnostics
eric 2019-07-26 11:54:24 -04:00
parent 415fb51401
commit 2fe006388d
11 changed files with 14 additions and 10 deletions

View File

@ -33,6 +33,9 @@ from libgutenberg import DublinCore
from libgutenberg import GutenbergDatabaseDublinCore from libgutenberg import GutenbergDatabaseDublinCore
from libgutenberg import GutenbergGlobals as gg from libgutenberg import GutenbergGlobals as gg
from i18n_tool import ugettext as _
from i18n_tool import ungettext as __
import DublinCoreI18n import DublinCoreI18n
from SupportedLocales import FB_LANGS, TWITTER_LANGS, GOOGLE_LANGS, PAYPAL_LANGS, FLATTR_LANGS from SupportedLocales import FB_LANGS, TWITTER_LANGS, GOOGLE_LANGS, PAYPAL_LANGS, FLATTR_LANGS

View File

@ -17,6 +17,8 @@ from __future__ import unicode_literals
import cherrypy import cherrypy
from libgutenberg import GutenbergGlobals as gg from libgutenberg import GutenbergGlobals as gg
from i18n_tool import ugettext as _
from i18n_tool import ungettext as __
import BaseSearcher import BaseSearcher
import Page import Page

View File

@ -24,17 +24,9 @@ import traceback
import cherrypy import cherrypy
from cherrypy.process import plugins from cherrypy.process import plugins
import six
from six.moves import builtins
from libgutenberg import GutenbergDatabase from libgutenberg import GutenbergDatabase
import i18n_tool
# Make translator functions available everywhere. Do this early, at
# least before Genshi starts loading templates.
builtins._ = i18n_tool.ugettext
builtins.__ = i18n_tool.ungettext
# this import causes ConnectionPool.ConnectionPool to become the cherrypy connection pool # this import causes ConnectionPool.ConnectionPool to become the cherrypy connection pool
import ConnectionPool import ConnectionPool

View File

@ -28,6 +28,7 @@ import requests_oauthlib
from requests import RequestException from requests import RequestException
from oauthlib.oauth2.rfc6749.errors import OAuth2Error from oauthlib.oauth2.rfc6749.errors import OAuth2Error
from i18n_tool import ugettext as _
import BaseSearcher import BaseSearcher
# pylint: disable=R0921 # pylint: disable=R0921

View File

@ -17,7 +17,7 @@ from __future__ import unicode_literals
import cherrypy import cherrypy
import babel import babel
from i18n_tool import ugettext as _
class DublinCoreI18nMixin (object): class DublinCoreI18nMixin (object):
""" Translator Mixin for GutenbergDatabaseDublinCore class. """ """ Translator Mixin for GutenbergDatabaseDublinCore class. """

View File

@ -23,6 +23,7 @@ import genshi.filters
import cherrypy import cherrypy
from i18n_tool import ugettext as _
import HTMLFormatter import HTMLFormatter
import OPDSFormatter import OPDSFormatter
import JSONFormatter import JSONFormatter

View File

@ -26,6 +26,7 @@ from libgutenberg.MediaTypes import mediatypes as mt
import BaseSearcher import BaseSearcher
import BaseFormatter import BaseFormatter
from i18n_tool import ugettext as _
# filetypes ignored on desktop site # filetypes ignored on desktop site
NO_DESKTOP_FILETYPES = 'plucker qioo rdf rst rst.gen rst.master tei cover.medium cover.small'.split () NO_DESKTOP_FILETYPES = 'plucker qioo rdf rst rst.gen rst.master tei cover.medium cover.small'.split ()

View File

@ -23,6 +23,7 @@ from libgutenberg.GutenbergDatabase import DatabaseError
import BaseSearcher import BaseSearcher
import Formatters import Formatters
from i18n_tool import ugettext as _
class Page (object): class Page (object):
""" Base for all pages. """ """ Base for all pages. """

View File

@ -21,6 +21,8 @@ from libgutenberg.DublinCore import DublinCore
import BaseSearcher import BaseSearcher
from Page import SearchPage from Page import SearchPage
from i18n_tool import ugettext as _
from i18n_tool import ungettext as __
class BookSearchPage (SearchPage): class BookSearchPage (SearchPage):

View File

@ -16,6 +16,7 @@ from __future__ import unicode_literals
import BaseSearcher import BaseSearcher
import Page import Page
from i18n_tool import ugettext as _
class Start (Page.Page): class Start (Page.Page):
""" The start page. """ """ The start page. """

View File

@ -14,7 +14,7 @@ which contains *all* Project Gutenberg metadata in one RDF/XML file.
<?python <?python
import re import re
from libgutenberg import GutenbergGlobals as gg from libgutenberg import GutenbergGlobals as gg
from i18n_tool import ugettext as _
if os.format == 'stanza': if os.format == 'stanza':
os.type_opds = "application/atom+xml" os.type_opds = "application/atom+xml"
opds_relations = { opds_relations = {