Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
nvidia-patch
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
nvidia-patch
Commits
7f5d669a
Commit
7f5d669a
authored
Aug 21, 2019
by
Snawoot
Committed by
GitHub
Aug 21, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #147 from Snawoot/ndl_improve_emails
ndl: improve emails
parents
0c7847b5
353e0568
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
tools/nv-driver-locator/nv-driver-locator.py
tools/nv-driver-locator/nv-driver-locator.py
+8
-4
No files found.
tools/nv-driver-locator/nv-driver-locator.py
View file @
7f5d669a
...
@@ -97,6 +97,7 @@ class EmailNotifier(BaseNotifier):
...
@@ -97,6 +97,7 @@ class EmailNotifier(BaseNotifier):
'email.mime.multipart'
)
.
MIMEMultipart
'email.mime.multipart'
)
.
MIMEMultipart
self
.
_MIMEBase
=
importlib
.
import_module
(
'email.mime.base'
)
.
MIMEBase
self
.
_MIMEBase
=
importlib
.
import_module
(
'email.mime.base'
)
.
MIMEBase
self
.
_encoders
=
importlib
.
import_module
(
'email.encoders'
)
self
.
_encoders
=
importlib
.
import_module
(
'email.encoders'
)
self
.
_mimeheader
=
importlib
.
import_module
(
'email.header'
)
.
Header
self
.
_m
=
self
.
_Mailer
(
from_addr
=
from_addr
,
self
.
_m
=
self
.
_Mailer
(
from_addr
=
from_addr
,
host
=
host
,
host
=
host
,
port
=
port
,
port
=
port
,
...
@@ -110,13 +111,16 @@ class EmailNotifier(BaseNotifier):
...
@@ -110,13 +111,16 @@ class EmailNotifier(BaseNotifier):
def
notify
(
self
,
obj
):
def
notify
(
self
,
obj
):
msg
=
self
.
_MIMEMult
()
msg
=
self
.
_MIMEMult
()
msg
[
'Subject'
]
=
"New Nvidia driver available!"
msg
[
'Subject'
]
=
self
.
_mimeheader
(
"New Nvidia driver available!"
,
"utf-8"
)
msg
[
'From'
]
=
self
.
_from_addr
msg
[
'From'
]
=
self
.
_from_addr
msg
[
'To'
]
=
', '
.
join
(
self
.
_to_addrs
)
msg
[
'To'
]
=
', '
.
join
(
self
.
_to_addrs
)
body
=
"See attached JSON"
obj_text
=
json
.
dumps
(
obj
,
indent
=
4
,
ensure_ascii
=
False
)
msg
.
attach
(
self
.
_MIMEText
(
body
,
'plain'
))
msg_text
=
json
.
dumps
(
obj
,
indent
=
4
,
ensure_ascii
=
True
)
body
=
"See attached JSON or message body below:
\n
"
body
+=
msg_text
msg
.
attach
(
self
.
_MIMEText
(
body
,
'plain'
,
'utf-8'
))
p
=
self
.
_MIMEBase
(
'application'
,
'octet-stream'
)
p
=
self
.
_MIMEBase
(
'application'
,
'octet-stream'
)
p
.
set_payload
(
json
.
dumps
(
obj
,
indent
=
4
)
.
encode
(
'utf-8
'
))
p
.
set_payload
(
obj_text
.
encode
(
'ascii
'
))
self
.
_encoders
.
encode_base64
(
p
)
self
.
_encoders
.
encode_base64
(
p
)
p
.
add_header
(
'Content-Disposition'
,
"attachment; filename=obj.json"
)
p
.
add_header
(
'Content-Disposition'
,
"attachment; filename=obj.json"
)
msg
.
attach
(
p
)
msg
.
attach
(
p
)
...
...
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