Skip to content

Commit 4944556

Browse files
committed
set new version
2 parents 2741e5d + 34332e9 commit 4944556

File tree

7 files changed

+332
-216
lines changed

7 files changed

+332
-216
lines changed

Pipfile

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@ verify_ssl = true
66
[dev-packages]
77

88
[packages]
9-
astroid = "==2.9.0"
10-
bleach = "==4.1.0"
11-
certifi = "==2021.10.8"
9+
astroid = "==2.11.5"
10+
bleach = "==5.0.0"
11+
certifi = "==2022.9.24"
1212
chardet = "==4.0.0"
13-
click = "==8.0.3"
13+
click = "==8.1.3"
1414
dataverse = {editable = true, git = "https://github.com/IQSS/dataverse-client-python.git", ref = "5f95a11e2f32bcfabe28e6ad43b2f7edac60d983"}
1515
first = "==2.0.2"
1616
html5lib = "==1.1"
1717
idna = "==3.3"
1818
isort = "==5.10.1"
1919
lazy-object-proxy = "==1.7.1"
20-
lxml = "==4.7.1"
21-
mccabe = "==0.6.1"
22-
psycopg2 = "==2.9.2"
23-
pylint = "==2.12.2"
24-
pyparsing = "==3.0.6"
25-
requests = "==2.26.0"
20+
lxml = "==4.9.1"
21+
mccabe = "==0.7.0"
22+
psycopg2-binary = "==2.9.4"
23+
pylint = "==2.13.8"
24+
pyparsing = "==3.0.8"
25+
requests = "==2.28.1"
2626
six = "==1.16.0"
2727
toml = "==0.10.2"
28-
typed-ast = "==1.5.1"
29-
urllib3 = "==1.26.7"
28+
typed-ast = "==1.5.3"
29+
urllib3 = "==1.26.12"
3030
webencodings = "==0.5.1"
31-
wrapt = "==1.13.3"
31+
wrapt = "==1.14.1"
3232
PyYAML = "==6.0"
33-
XlsxWriter = "==3.0.2"
33+
XlsxWriter = "==3.0.3"
3434

3535
[requires]
3636
python_version = "3.7"

Pipfile.lock

Lines changed: 287 additions & 196 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ work_dir: '/tmp'
3636
log_path: 'logs'
3737
log_file: 'dataverse-reports.log'
3838
log_level: 'INFO'
39+
smtp_host: 'localhost'
40+
smtp_auth: ''
41+
smtp_port: 25
42+
smtp_username: 'username'
43+
smtp_password: 'password'
3944
from_email: ''
4045
admin_emails:
4146
- email1
@@ -55,7 +60,7 @@ accounts:
5560
- email1
5661
```
5762
58-
Set parameters for API and database connections. Accounts list refers to top-level dataverses on which reports based at the institutional level will begin.
63+
Set parameters for API and database connections, as well as the SMTP configuration. Accounts list refers to top-level dataverses on which reports based at the institutional level will begin.
5964
6065
NOTE: The accounts section can be left blank if your Dataverse instance is not set up with separate institutions as top-level dataverses. In that case, your reports will be for everything from the root dataverse on down and sent to all admins.
6166

config/application.yml.sample

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ work_dir: '/tmp'
99
log_path: 'logs'
1010
log_file: 'dataverse-reports.log'
1111
log_level: 'INFO'
12+
smtp_host: 'localhost'
13+
smtp_auth: ''
14+
smtp_port: 25
15+
smtp_username: 'username'
16+
smtp_password: 'password'
1217
from_email: ''
1318
admin_emails:
1419
- email1

lib/email.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,20 @@ def email_report_internal(self, report_file_paths=[], to_email=None, from_email=
7474
part.add_header('Content-Disposition', "attachment; filename= %s" % report_file_name)
7575
message.attach(part)
7676

77+
78+
# Get SMTP configuration
79+
smtp_host = self.config['smtp_host']
80+
smtp_auth = self.config['smtp_auth']
81+
smtp_port = self.config['smtp_port']
82+
smtp_username = self.config['smtp_username']
83+
smtp_password = self.config['smtp_password']
84+
7785
# Send email
78-
self.logger.info("Sending dataverse report to %s.", to_email)
79-
with smtplib.SMTP('localhost') as s:
80-
s.send_message(message)
86+
self.logger.info('Sending Dataverse report to {email}.'.format(email=to_email))
87+
server = smtplib.SMTP(smtp_host, smtp_port)
88+
if smtp_auth == 'tls':
89+
server.starttls()
90+
if smtp_username and smtp_password:
91+
server.login(smtp_username, smtp_password)
92+
server.send_message(message)
93+
server.quit()

reports/user.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ def load_all_users_list(self):
5252
def find_user_email(self, email):
5353
user = {}
5454

55+
email_lower = email.casefold()
56+
5557
for u in self.all_users:
56-
if email == u['email']:
58+
if 'email' in u and email_lower == u['email'].casefold():
5759
user = u
5860

5961
return user

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setup(
1010
name = 'dataverse-reports',
11-
version='1.3.0',
11+
version='1.4.0',
1212
url = 'https://www.tdl.org/',
1313
author = 'Nicholas Woodward',
1414
author_email = '[email protected]',

0 commit comments

Comments
 (0)