mirror of
https://github.com/wassname/flask-security.git
synced 2026-07-18 12:20:29 +08:00
Even more polish
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user