+
+ def dump_to(self, path, directory=None):
+ """ Path should be name for main file. """
+ self.save_as(path)
+ dirname = os.path.dirname(os.path.abspath(path))
+ for filename, attachment in self.attachments.items():
+ attachment.save_as(os.path.join(dirname, filename))
+
+
+class Format(object):
+ """ Generic format class. """
+ def __init__(self, wldoc, **kwargs):
+ self.wldoc = wldoc
+ self.customization = kwargs
+
+ def build(self):
+ raise NotImplementedError
+
+
+class URLOpener(urllib.FancyURLopener):
+ version = 'FNP Librarian (http://github.com/fnp/librarian)'
+urllib._urlopener = URLOpener()