plugin account, tools: some cleaning account + email and password tools:
- plugin misc account has been reordered and cleaned a bit.
- new xmpp_domain setting is used to get the domain name of main XMPP server
- password generation method has been moved to tools.utils
- email sending method has been moved to tools.email
This commit is contained in:
parent
bb48d87434
commit
25c07ce105
1 changed files with 138 additions and 80 deletions
|
|
@ -26,6 +26,7 @@ log = getLogger(__name__)
|
|||
import datetime
|
||||
import time
|
||||
import sys
|
||||
import random
|
||||
|
||||
|
||||
def clean_ustr(ustr):
|
||||
|
|
@ -54,6 +55,17 @@ def xmpp_date(timestamp=None, with_time=True):
|
|||
template = u"{}T{}".format(template_date, template_time) if with_time else template_date
|
||||
return datetime.datetime.utcfromtimestamp(time.time() if timestamp is None else timestamp).strftime(template)
|
||||
|
||||
def generatePassword(vocabulary=None, size=20):
|
||||
"""Generate a password with random characters.
|
||||
|
||||
@param vocabulary(iterable): characters to use to create password
|
||||
@param size(int): number of characters in the password to generate
|
||||
@return (unicode): generated password
|
||||
"""
|
||||
random.seed()
|
||||
if vocabulary is None:
|
||||
vocabulary = [chr(i) for i in range(0x30,0x3A) + range(0x41,0x5B) + range (0x61,0x7B)]
|
||||
return u''.join([random.choice(vocabulary) for i in range(15)])
|
||||
|
||||
def getRepositoryData(module, as_string=True, is_path=False, save_dir_path=None):
|
||||
"""Retrieve info on current mecurial repository
|
||||
|
|
|
|||
Loading…
Reference in a new issue