import shutil
import sqlalchemy
import sqlalchemy.exc
-import random
import string
import urlparse
import tempfile
deprecated_keys = set()
#: Keys that we can simply generate random strings for if they're missing
random_keys = set()
+ #: Values that are not sufficiently random for a random key. This can
+ #: include default values for a random configuration option,
+ random_blacklist = set()
#: Dictionary of variable names to extractor functions. These functions
#: take a :class:`wizard.deploy.Deployment` as an argument and return the value of
#: the variable, or ``None`` if it could not be found.
result[k] = extractor(deployment)
# XXX: ugh... we have to do quoting
for k in self.random_keys:
- if result[k] is None:
- result[k] = "'%s'" % ''.join(random.choice(string.letters + string.digits) for i in xrange(30))
+ if result[k] is None or result[k] in self.random_blacklist:
+ result[k] = "'%s'" % util.random_key()
return result
def dsn(self, deployment):
"""
:attr:`parametrized_files` and a simple search and replace on those
files.
"""
+ # deployment is not used in this implementation, but note that
+ # we do have the invariant the current directory matches
+ # deployment's directory
variables = ref_deployment.extract()
for file in self.parametrized_files:
try: