Even more polish

This commit is contained in:
Matt Wright
2012-08-23 20:56:13 -04:00
parent b052e09cd6
commit f1c52d01aa
4 changed files with 31 additions and 69 deletions
-39
View File
@@ -105,42 +105,3 @@ class ActivateUserCommand(_ToggleActiveCommand):
def run(self, user_identifier):
_datastore.activate_user(user_identifier)
print "User '%s' has been activated" % user_identifier
class GenerateBlueprintCommand(Command):
"""Generate a Flask-Security blueprint object"""
option_list = (
Option('--output', '-o', dest='output', default=None),
)
def run(self, output):
output = os.path.join(os.getcwd(), output) if output else 'security.py'
if os.path.exists(output):
msg = 'File %s exists. Do you want to overwrite it?' % output
if not prompt_bool(msg):
return
with open(output, 'w') as o:
source = inspect.getfile(views).replace('.pyc', '.py')
with open(source, 'r') as s:
to_remove = '"""' + views.__doc__ + '"""'
to_replace = """
\"""
Flask-Security
~~~~~~~~~~~~~~
This module was generated by Flask-Security to give developers greater
control over the various security mechanisms. For more information about
using this feature see:
TODO: Documentation URL
\"""
"""
contents = s.read().replace(to_remove, to_replace)
o.write(contents)
print 'File generated successfully.'
print output