From a0c7396ab5e3eeaef01c44b5d1145a740002a1d1 Mon Sep 17 00:00:00 2001 From: "Marshall T. Vandegrift" Date: Thu, 5 Feb 2009 11:24:08 -0500 Subject: [PATCH] Clean-up clean-up. --- src/calibre/ebooks/oeb/base.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index 62d96dfd9d..778cec54cf 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -97,7 +97,7 @@ OPF_MIME = types_map['.opf'] PAGE_MAP_MIME = 'application/oebps-page-map+xml' OEB_DOC_MIME = 'text/x-oeb1-document' OEB_CSS_MIME = 'text/x-oeb1-css' -OPENTYPE_MIME = 'font/opentype' # Shouldn't this be 'application/x-font-opentype' as opentype/font doesn't actually exist in the IETF? +OPENTYPE_MIME = 'application/x-font-opentype' GIF_MIME = types_map['.gif'] JPEG_MIME = types_map['.jpeg'] PNG_MIME = types_map['.png'] @@ -177,7 +177,7 @@ URL_SAFE = set('ABCDEFGHIJKLMNOPQRSTUVWXYZ' '0123456789' '_.-/~') URL_UNSAFE = [ASCII_CHARS - URL_SAFE, UNIBYTE_CHARS - URL_SAFE] -def urlquote(href): # Why do you have a private implementation of urlquote? +def urlquote(href): result = [] unsafe = 0 if isinstance(href, unicode) else 1 unsafe = URL_UNSAFE[unsafe] @@ -282,7 +282,9 @@ class Metadata(object): class Attribute(object): def __init__(self, attr, allowed=None): - self.attr = attr if callable(attr) else lambda x: attr + if not callable(attr): + attr_, attr = attr, lambda term: attr_ + self.attr = attr self.allowed = allowed def term_attr(self, obj):