Commit 3c164038 authored by shenshuo's avatar shenshuo

优化mail判断

parent f03212d4
......@@ -9,7 +9,7 @@ from distutils.core import setup
setup(
name='opssdk',
version='0.0.15',
version='0.0.16',
packages=['opssdk', 'opssdk.logs', 'opssdk.operate', 'opssdk.install', 'opssdk.get_info', 'opssdk.utils', 'websdk'],
url='https://github.com/ss1917/ops_sdk/',
license='',
......
......@@ -40,12 +40,12 @@ def get_db_url(dbkey):
dbuser = db_conf['user']
dbpwd = db_conf['pwd']
dbhost = db_conf['host']
dbport = db_conf.get('port', 0)
dbport = db_conf.get('port', 3306)
dbname = db_conf['name']
url = 'mysql+pymysql://{user}:{pwd}@{host}:{port}/{dbname}?charset=utf8'.format(user=dbuser, pwd=quote_plus(dbpwd),
host=dbhost, port=dbport,
dbname=dbname)
return url
return 'mysql+pymysql://{user}:{pwd}@{host}:{port}/{dbname}?charset=utf8'.format(user=dbuser, pwd=quote_plus(dbpwd),
host=dbhost, port=dbport,
dbname=dbname, poolclass=NullPool)
class DBContext(object):
......
......@@ -48,12 +48,14 @@ def is_mail(text, login_mail=None):
return True
else:
return False
if re.match(r'^[0-9a-zA-Z_]{0,19}@[0-9a-zA-Z]{1,13}\.[com,cn,net]{1,3}$', text):
p = re.compile(r"[^@]+@[^@]+\.[^@]+")
# if re.match(r'^[0-9a-zA-Z_]{0,19}@[0-9a-zA-Z]{1,13}\.[com,cn,net]{1,3}$', text):
if p.match(text):
return True
else:
return False
def is_tel(tel):
### 检查是否是手机号
ret = re.match(r"^1[35678]\d{9}$", tel)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment