Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
1840efa0
Commit
1840efa0
authored
1 year ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
gen-mailing-list: Konfigurovatelné výjimky
parent
f0e5acf9
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/gen-mailing-list
+13
-3
13 additions, 3 deletions
bin/gen-mailing-list
etc/config.py.example
+8
-0
8 additions, 0 deletions
etc/config.py.example
with
21 additions
and
3 deletions
bin/gen-mailing-list
+
13
−
3
View file @
1840efa0
...
@@ -6,7 +6,7 @@ from sqlalchemy import or_
...
@@ -6,7 +6,7 @@ from sqlalchemy import or_
import
sys
import
sys
import
mo
import
mo
import
mo.config
import
mo.config
as
config
import
mo.db
as
db
import
mo.db
as
db
from
mo.util
import
die
,
init_standalone
from
mo.util
import
die
,
init_standalone
...
@@ -17,14 +17,24 @@ args = parser.parse_args()
...
@@ -17,14 +17,24 @@ args = parser.parse_args()
init_standalone
()
init_standalone
()
if
args
.
typ
!=
'
garanti-z
'
:
die
(
"
Neznámý typ mailing listu
"
)
sess
=
db
.
get_session
()
sess
=
db
.
get_session
()
users
=
(
sess
.
query
(
db
.
User
)
users
=
(
sess
.
query
(
db
.
User
)
.
join
(
db
.
UserRole
,
db
.
UserRole
.
user_id
==
db
.
User
.
user_id
)
.
join
(
db
.
UserRole
,
db
.
UserRole
.
user_id
==
db
.
User
.
user_id
)
.
filter
(
db
.
UserRole
.
role
.
in_
([
db
.
RoleType
.
garant_okres
,
db
.
RoleType
.
garant_kraj
,
db
.
RoleType
.
garant
]))
.
filter
(
db
.
UserRole
.
role
.
in_
([
db
.
RoleType
.
garant_okres
,
db
.
RoleType
.
garant_kraj
,
db
.
RoleType
.
garant
]))
.
filter
(
or_
(
db
.
UserRole
.
year
==
None
,
db
.
UserRole
.
year
==
mo
.
config
.
CURRENT_YEAR
))
.
filter
(
or_
(
db
.
UserRole
.
year
==
None
,
db
.
UserRole
.
year
==
config
.
CURRENT_YEAR
))
.
filter
(
or_
(
db
.
UserRole
.
category
==
None
,
db
.
UserRole
.
category
!=
'
P
'
))
.
filter
(
or_
(
db
.
UserRole
.
category
==
None
,
db
.
UserRole
.
category
!=
'
P
'
))
.
all
())
.
all
())
addrs
=
set
(
u
.
email
for
u
in
users
)
addrs
=
set
(
u
.
email
for
u
in
users
)
if
hasattr
(
config
,
'
MAILING_LIST_INCLUDE
'
)
and
args
.
typ
in
config
.
MAILING_LIST_INCLUDE
:
for
addr
in
config
.
MAILING_LIST_INCLUDE
[
args
.
typ
]:
addrs
.
add
(
addr
)
if
hasattr
(
config
,
'
MAILING_LIST_EXCLUDE
'
)
and
args
.
typ
in
config
.
MAILING_LIST_EXCLUDE
:
for
addr
in
config
.
MAILING_LIST_EXCLUDE
[
args
.
typ
]:
addrs
.
discard
(
addr
)
for
a
in
sorted
(
addrs
):
for
a
in
sorted
(
addrs
):
print
(
a
)
print
(
a
)
This diff is collapsed.
Click to expand it.
etc/config.py.example
+
8
−
0
View file @
1840efa0
...
@@ -87,3 +87,11 @@ MO_WEB_PASSWD = 'BrumBrum'
...
@@ -87,3 +87,11 @@ MO_WEB_PASSWD = 'BrumBrum'
# Povolení loginu bez hesla pro testovací uživatele (s adresou končící na @test).
# Povolení loginu bez hesla pro testovací uživatele (s adresou končící na @test).
# Nezapínat mimo testovací prostředí! Bydlí na /test-login/<email>.
# Nezapínat mimo testovací prostředí! Bydlí na /test-login/<email>.
#INSECURE_TEST_LOGIN = True
#INSECURE_TEST_LOGIN = True
# Výjimky pro bin/gen-mailing-list
MAILING_LIST_INCLUDE = {
# 'garanti-z': ['somebody@example.org'],
}
MAILING_LIST_EXCLUDE = {
# 'garanti-z': ['somebody@example.com'],
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment