Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
ops_sdk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PublicSource
ops_sdk
Commits
3c164038
Commit
3c164038
authored
Sep 11, 2019
by
shenshuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化mail判断
parent
f03212d4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
8 deletions
+10
-8
setup.py
setup.py
+1
-1
db_context.py
websdk/db_context.py
+5
-5
tools.py
websdk/tools.py
+4
-2
No files found.
setup.py
View file @
3c164038
...
@@ -9,7 +9,7 @@ from distutils.core import setup
...
@@ -9,7 +9,7 @@ from distutils.core import setup
setup
(
setup
(
name
=
'opssdk'
,
name
=
'opssdk'
,
version
=
'0.0.1
5
'
,
version
=
'0.0.1
6
'
,
packages
=
[
'opssdk'
,
'opssdk.logs'
,
'opssdk.operate'
,
'opssdk.install'
,
'opssdk.get_info'
,
'opssdk.utils'
,
'websdk'
],
packages
=
[
'opssdk'
,
'opssdk.logs'
,
'opssdk.operate'
,
'opssdk.install'
,
'opssdk.get_info'
,
'opssdk.utils'
,
'websdk'
],
url
=
'https://github.com/ss1917/ops_sdk/'
,
url
=
'https://github.com/ss1917/ops_sdk/'
,
license
=
''
,
license
=
''
,
...
...
websdk/db_context.py
View file @
3c164038
...
@@ -40,12 +40,12 @@ def get_db_url(dbkey):
...
@@ -40,12 +40,12 @@ def get_db_url(dbkey):
dbuser
=
db_conf
[
'user'
]
dbuser
=
db_conf
[
'user'
]
dbpwd
=
db_conf
[
'pwd'
]
dbpwd
=
db_conf
[
'pwd'
]
dbhost
=
db_conf
[
'host'
]
dbhost
=
db_conf
[
'host'
]
dbport
=
db_conf
.
get
(
'port'
,
0
)
dbport
=
db_conf
.
get
(
'port'
,
3306
)
dbname
=
db_conf
[
'name'
]
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
,
return
'mysql+pymysql://{user}:{pwd}@{host}:{port}/{dbname}?charset=utf8'
.
format
(
user
=
dbuser
,
pwd
=
quote_plus
(
dbpwd
)
,
dbname
=
dbname
)
host
=
dbhost
,
port
=
dbport
,
return
url
dbname
=
dbname
,
poolclass
=
NullPool
)
class
DBContext
(
object
):
class
DBContext
(
object
):
...
...
websdk/tools.py
View file @
3c164038
...
@@ -48,12 +48,14 @@ def is_mail(text, login_mail=None):
...
@@ -48,12 +48,14 @@ def is_mail(text, login_mail=None):
return
True
return
True
else
:
else
:
return
False
return
False
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 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
return
True
else
:
else
:
return
False
return
False
def
is_tel
(
tel
):
def
is_tel
(
tel
):
### 检查是否是手机号
### 检查是否是手机号
ret
=
re
.
match
(
r"^1[35678]\d{9}$"
,
tel
)
ret
=
re
.
match
(
r"^1[35678]\d{9}$"
,
tel
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment