mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Rename function.
This commit is contained in:
parent
8e166a19d6
commit
381e3db369
@ -473,11 +473,11 @@ def as_unicode(obj, enc=preferred_encoding):
|
|||||||
obj = repr(obj)
|
obj = repr(obj)
|
||||||
return force_unicode(obj, enc=enc)
|
return force_unicode(obj, enc=enc)
|
||||||
|
|
||||||
def http_url_slash_cleaner(url):
|
def url_slash_cleaner(url):
|
||||||
'''
|
'''
|
||||||
Removes redundant /'s from url's.
|
Removes redundant /'s from url's.
|
||||||
'''
|
'''
|
||||||
return re.sub(r'(?<!http:)/{2,}', '/', url)
|
return re.sub(r'(?<!:)/{2,}', '/', url)
|
||||||
|
|
||||||
def human_readable(size):
|
def human_readable(size):
|
||||||
""" Convert a size in bytes into a human readable form """
|
""" Convert a size in bytes into a human readable form """
|
||||||
|
@ -12,7 +12,7 @@ from lxml import html
|
|||||||
|
|
||||||
from PyQt4.Qt import QUrl
|
from PyQt4.Qt import QUrl
|
||||||
|
|
||||||
from calibre import browser, http_url_slash_cleaner
|
from calibre import browser, url_slash_cleaner
|
||||||
from calibre.gui2 import open_url
|
from calibre.gui2 import open_url
|
||||||
from calibre.gui2.store import StorePlugin
|
from calibre.gui2.store import StorePlugin
|
||||||
from calibre.gui2.store.basic_config import BasicStoreConfig
|
from calibre.gui2.store.basic_config import BasicStoreConfig
|
||||||
@ -33,7 +33,7 @@ class DieselEbooksStore(BasicStoreConfig, StorePlugin):
|
|||||||
if external or settings.get(self.name + '_open_external', False):
|
if external or settings.get(self.name + '_open_external', False):
|
||||||
if detail_item:
|
if detail_item:
|
||||||
url = url + detail_item
|
url = url + detail_item
|
||||||
open_url(QUrl(http_url_slash_cleaner(url + aff_id)))
|
open_url(QUrl(url_slash_cleaner(url + aff_id)))
|
||||||
else:
|
else:
|
||||||
d = WebStoreDialog(self.gui, url + aff_id, parent, detail_item)
|
d = WebStoreDialog(self.gui, url + aff_id, parent, detail_item)
|
||||||
d.setWindowTitle(self.name)
|
d.setWindowTitle(self.name)
|
||||||
|
@ -11,7 +11,7 @@ from lxml import html
|
|||||||
|
|
||||||
from PyQt4.Qt import QUrl
|
from PyQt4.Qt import QUrl
|
||||||
|
|
||||||
from calibre import browser, http_url_slash_cleaner
|
from calibre import browser, url_slash_cleaner
|
||||||
from calibre.gui2 import open_url
|
from calibre.gui2 import open_url
|
||||||
from calibre.gui2.store import StorePlugin
|
from calibre.gui2.store import StorePlugin
|
||||||
from calibre.gui2.store.basic_config import BasicStoreConfig
|
from calibre.gui2.store.basic_config import BasicStoreConfig
|
||||||
@ -28,7 +28,7 @@ class FeedbooksStore(BasicStoreConfig, StorePlugin):
|
|||||||
if external or settings.get(self.name + '_open_external', False):
|
if external or settings.get(self.name + '_open_external', False):
|
||||||
if detail_item:
|
if detail_item:
|
||||||
ext_url = ext_url + detail_item
|
ext_url = ext_url + detail_item
|
||||||
open_url(QUrl(http_url_slash_cleaner(ext_url)))
|
open_url(QUrl(url_slash_cleaner(ext_url)))
|
||||||
else:
|
else:
|
||||||
d = WebStoreDialog(self.gui, url, parent, detail_item)
|
d = WebStoreDialog(self.gui, url, parent, detail_item)
|
||||||
d.setWindowTitle(self.name)
|
d.setWindowTitle(self.name)
|
||||||
|
@ -11,7 +11,7 @@ from lxml import html
|
|||||||
|
|
||||||
from PyQt4.Qt import QUrl
|
from PyQt4.Qt import QUrl
|
||||||
|
|
||||||
from calibre import browser, http_url_slash_cleaner
|
from calibre import browser, url_slash_cleaner
|
||||||
from calibre.gui2 import open_url
|
from calibre.gui2 import open_url
|
||||||
from calibre.gui2.store import StorePlugin
|
from calibre.gui2.store import StorePlugin
|
||||||
from calibre.gui2.store.basic_config import BasicStoreConfig
|
from calibre.gui2.store.basic_config import BasicStoreConfig
|
||||||
@ -28,7 +28,7 @@ class GutenbergStore(BasicStoreConfig, StorePlugin):
|
|||||||
if external or settings.get(self.name + '_open_external', False):
|
if external or settings.get(self.name + '_open_external', False):
|
||||||
if detail_item:
|
if detail_item:
|
||||||
ext_url = ext_url + detail_item
|
ext_url = ext_url + detail_item
|
||||||
open_url(QUrl(http_url_slash_cleaner(ext_url)))
|
open_url(QUrl(url_slash_cleaner(ext_url)))
|
||||||
else:
|
else:
|
||||||
d = WebStoreDialog(self.gui, url, parent, detail_item)
|
d = WebStoreDialog(self.gui, url, parent, detail_item)
|
||||||
d.setWindowTitle(self.name)
|
d.setWindowTitle(self.name)
|
||||||
|
@ -12,7 +12,7 @@ from lxml import html
|
|||||||
|
|
||||||
from PyQt4.Qt import QUrl
|
from PyQt4.Qt import QUrl
|
||||||
|
|
||||||
from calibre import browser, http_url_slash_cleaner
|
from calibre import browser, url_slash_cleaner
|
||||||
from calibre.gui2 import open_url
|
from calibre.gui2 import open_url
|
||||||
from calibre.gui2.store import StorePlugin
|
from calibre.gui2.store import StorePlugin
|
||||||
from calibre.gui2.store.basic_config import BasicStoreConfig
|
from calibre.gui2.store.basic_config import BasicStoreConfig
|
||||||
@ -28,7 +28,7 @@ class ManyBooksStore(BasicStoreConfig, StorePlugin):
|
|||||||
if external or settings.get(self.name + '_open_external', False):
|
if external or settings.get(self.name + '_open_external', False):
|
||||||
if detail_item:
|
if detail_item:
|
||||||
url = url + detail_item
|
url = url + detail_item
|
||||||
open_url(QUrl(http_url_slash_cleaner(url)))
|
open_url(QUrl(url_slash_cleaner(url)))
|
||||||
else:
|
else:
|
||||||
d = WebStoreDialog(self.gui, url, parent, detail_item)
|
d = WebStoreDialog(self.gui, url, parent, detail_item)
|
||||||
d.setWindowTitle(self.name)
|
d.setWindowTitle(self.name)
|
||||||
|
@ -13,7 +13,7 @@ from lxml import html
|
|||||||
|
|
||||||
from PyQt4.Qt import QUrl
|
from PyQt4.Qt import QUrl
|
||||||
|
|
||||||
from calibre import browser, http_url_slash_cleaner
|
from calibre import browser, url_slash_cleaner
|
||||||
from calibre.gui2 import open_url
|
from calibre.gui2 import open_url
|
||||||
from calibre.gui2.store import StorePlugin
|
from calibre.gui2.store import StorePlugin
|
||||||
from calibre.gui2.store.basic_config import BasicStoreConfig
|
from calibre.gui2.store.basic_config import BasicStoreConfig
|
||||||
@ -34,7 +34,7 @@ class SmashwordsStore(BasicStoreConfig, StorePlugin):
|
|||||||
if external or settings.get(self.name + '_open_external', False):
|
if external or settings.get(self.name + '_open_external', False):
|
||||||
if detail_item:
|
if detail_item:
|
||||||
url = url + detail_item
|
url = url + detail_item
|
||||||
open_url(QUrl(http_url_slash_cleaner(url + aff_id)))
|
open_url(QUrl(url_slash_cleaner(url + aff_id)))
|
||||||
else:
|
else:
|
||||||
d = WebStoreDialog(self.gui, url + aff_id, parent, detail_item)
|
d = WebStoreDialog(self.gui, url + aff_id, parent, detail_item)
|
||||||
d.setWindowTitle(self.name)
|
d.setWindowTitle(self.name)
|
||||||
|
@ -9,7 +9,7 @@ import urllib
|
|||||||
|
|
||||||
from PyQt4.Qt import QDialog, QUrl
|
from PyQt4.Qt import QDialog, QUrl
|
||||||
|
|
||||||
from calibre import http_url_slash_cleaner
|
from calibre import url_slash_cleaner
|
||||||
from calibre.gui2.store.web_store_dialog_ui import Ui_Dialog
|
from calibre.gui2.store.web_store_dialog_ui import Ui_Dialog
|
||||||
|
|
||||||
class WebStoreDialog(QDialog, Ui_Dialog):
|
class WebStoreDialog(QDialog, Ui_Dialog):
|
||||||
@ -52,5 +52,5 @@ class WebStoreDialog(QDialog, Ui_Dialog):
|
|||||||
# Reduce redundant /'s because some stores
|
# Reduce redundant /'s because some stores
|
||||||
# (Feedbooks) and server frameworks (cherrypy)
|
# (Feedbooks) and server frameworks (cherrypy)
|
||||||
# choke on them.
|
# choke on them.
|
||||||
url = http_url_slash_cleaner(url)
|
url = url_slash_cleaner(url)
|
||||||
self.view.load(QUrl(url))
|
self.view.load(QUrl(url))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user