Пример #1
0
    def handle(self, options, global_options, *args):
        from random import choice
        from uliweb.core.SimpleFrame import get_settings
        from uliweb.core.commands import get_answer

        settings = get_settings(
            global_options.project,
            settings_file=global_options.settings,
            local_settings_file=global_options.local_settings)
        output = options.output or settings.SECRETKEY.SECRET_FILE
        keyfile = os.path.join(global_options.project, output)
        if os.path.exists(keyfile):
            ans = get_answer(
                'The file %s is already existed, do you want to overwrite' %
                keyfile)
            if ans == 'n':
                return
        print 'Creating secretkey file %s...' % keyfile,
        f = open(keyfile, 'wb')
        secret_key = ''.join([
            choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)')
            for i in range(settings.SECRETKEY.KEY_LENGTH)
        ])
        f.write(secret_key)
        print 'OK'
Пример #2
0
 def handle(self, options, global_options, *args):
     from random import choice
     from uliweb.core.SimpleFrame import get_settings
     settings = get_settings(global_options.project, settings_file=global_options.settings, 
         local_settings_file=global_options.local_settings)
     keyfile = os.path.join(global_options.project, settings.SECRETKEY.SECRET_FILE)
     f = open(keyfile, 'wb')
     secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(settings.SECRETKEY.KEY_LENGTH)])
     f.write(secret_key)
Пример #3
0
 def handle(self, options, global_options, *args):
     from random import choice
     from uliweb.core.SimpleFrame import get_settings
     settings = get_settings(
         global_options.project,
         settings_file=global_options.settings,
         local_settings_file=global_options.local_settings)
     keyfile = os.path.join(global_options.project,
                            settings.SECRETKEY.SECRET_FILE)
     f = open(keyfile, 'wb')
     secret_key = ''.join([
         choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)')
         for i in range(settings.SECRETKEY.KEY_LENGTH)
     ])
     f.write(secret_key)
Пример #4
0
 def handle(self, options, global_options, *args):
     from uliweb import functions
     from uliweb.core.SimpleFrame import get_settings, __global__
     import getpass
     
     settings = get_settings(global_options.project, settings_file=global_options.settings, 
         local_settings_file=global_options.local_settings)
     __global__.settings = settings
     password = getpass.getpass('Input your password(Blank will quit):')
     if not password:
         return
     password1 = getpass.getpass('Enter your password twice:')
     if password != password1:
         print "Your password is not matched, please run the command again"
     else:
         print functions.encrypt_password(password)
Пример #5
0
    def handle(self, options, global_options, *args):
        from uliweb import functions
        from uliweb.core.SimpleFrame import get_settings, __global__
        import getpass

        settings = get_settings(
            global_options.project,
            settings_file=global_options.settings,
            local_settings_file=global_options.local_settings)
        __global__.settings = settings
        password = getpass.getpass('Input your password(Blank will quit):')
        if not password:
            return
        password1 = getpass.getpass('Enter your password twice:')
        if password != password1:
            print "Your password is not matched, please run the command again"
        else:
            print functions.encrypt_password(password)
Пример #6
0
 def handle(self, options, global_options, *args):
     from random import choice
     from uliweb.core.SimpleFrame import get_settings
     from uliweb.core.commands import get_answer
     
     settings = get_settings(global_options.project, settings_file=global_options.settings, 
         local_settings_file=global_options.local_settings)
     output = options.output or settings.SECRETKEY.SECRET_FILE
     keyfile = os.path.join(global_options.project, output)
     if os.path.exists(keyfile):
         message = 'The file %s is already existed, do you want to overwrite' % keyfile
         ans = 'Y' if global_options.yes else get_answer(message)
         if ans != 'Y':
             return
     print 'Creating secretkey file %s...' % keyfile,
     f = open(keyfile, 'wb')
     secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(settings.SECRETKEY.KEY_LENGTH)])
     f.write(secret_key)
     print 'OK'
Пример #7
0
    def handle(self, options, global_options, *args):
        from random import choice
        from uliweb.core.SimpleFrame import get_settings
        from uliweb.core.commands import get_answer

        settings = get_settings(
            global_options.project,
            settings_file=global_options.settings,
            local_settings_file=global_options.local_settings,
        )
        output = options.output or settings.SECRETKEY.SECRET_FILE
        keyfile = os.path.join(global_options.project, output)
        if os.path.exists(keyfile):
            ans = get_answer("The file %s is already existed, do you want to overwrite" % keyfile)
            if ans == "n":
                return
        print "Creating secretkey file %s..." % keyfile,
        f = open(keyfile, "wb")
        secret_key = "".join(
            [choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)") for i in range(settings.SECRETKEY.KEY_LENGTH)]
        )
        f.write(secret_key)
        print "OK"