[enh] be more pythonic

This commit is contained in:
Julien Malik 2016-02-19 08:51:18 +01:00
parent 121a37dea1
commit c71008a5ce

View File

@ -46,8 +46,8 @@ class Image(object):
"target": target,
"auto-orient" : "-auto-orient" if options["auto-orient"] else "",
"strip": "-strip" if options["strip"] else "",
"quality": "-quality %s" % options["quality"] if options.has_key("quality") else "-define jpeg:preserve-settings",
"resize": "-resize %s" % options["resize"] if options.has_key("resize") and options["resize"] is not None else ""
"quality": "-quality %s" % options["quality"] if "quality" in options else "-define jpeg:preserve-settings",
"resize": "-resize %s" % options["resize"] if options.get("resize", None) is not None else ""
}
command = "gm convert {source} {auto-orient} {strip} {quality} {resize} {target}".format(**gm_switches)
print command
@ -56,7 +56,6 @@ class Image(object):
else:
print "skipped %s since it's already generated (based on source unchanged size and images options set in your gallery's settings.yaml)" % target
def copy(self):
source, target = os.path.join(self.base_dir, self.name), os.path.join(self.target_dir, self.name)