Skip to content
Browse files

Merge branch 'master' of git://github.com/robhudson/dumpy

Conflicts:
	dumpy/dumper.py
  • Loading branch information...
2 parents 109567c + c6433c7 commit 4652a6a357421a45009188da118f63a6decce171 Clinton Ecker committed
Showing with 18 additions and 7 deletions.
  1. +18 −7 dumpy/dumper.py
View
25 dumpy/dumper.py
@@ -6,8 +6,14 @@
from optparse import OptionParser
import logging
-from boto.s3.key import Key
-from boto.s3.connection import S3Connection
+try:
+ import boto
+except ImportError:
+ boto = None
+else:
+ from boto.s3.key import Key
+ from boto.s3.connection import S3Connection
+
# Process options:
# dumpy --database [database name]
@@ -238,15 +244,17 @@ def __init__(self, db):
def parse_config(self):
super(PostProcess, self).parse_config()
- self.processors = self._get_option_value(self.config, 'database %s' % (self.db), 'postprocessing')
+ self.processors = self._get_option_value(self.config, 'database %s' % (self.db,), 'postprocessing')
def process(self, file):
self.parse_config()
- processors = [p.strip() for p in self.processors.split(',')]
+
+ if self.processors:
+ processors = [p.strip() for p in self.processors.split(',')]
- for processor in processors:
- logger.info('%s - ' % (self.db,) + processor) #FIXME
- file = globals()[processor](self.db).process(file)
+ for processor in processors:
+ logger.info('%s - ' % (self.db,) + processor)
+ file = globals()[processor](self.db).process(file)
class Bzip(PostProcessBase):
"""
@@ -342,6 +350,9 @@ def parse_config(self):
self.bucket = self._get_option_value(self.config, 'S3Copy options', 'bucket')
def process(self, file):
+ if boto is None:
+ raise Exception("You must have boto installed before using S3 support.")
+
self.parse_config()
conn = S3Connection(self.access_key, self.secret_key)

0 comments on commit 4652a6a

Please sign in to comment.
Something went wrong with that request. Please try again.