Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pymilter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
misc
pymilter
Commits
bd0df5d7
Commit
bd0df5d7
authored
12 years ago
by
Stuart Gathman
Browse files
Options
Downloads
Patches
Plain Diff
Accept any combination of lists and space separated strings.
parent
34746823
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Milter/__init__.py
+15
-7
15 additions, 7 deletions
Milter/__init__.py
Milter/test.py
+11
-3
11 additions, 3 deletions
Milter/test.py
with
26 additions
and
10 deletions
Milter/__init__.py
+
15
−
7
View file @
bd0df5d7
...
@@ -441,18 +441,26 @@ class Base(object):
...
@@ -441,18 +441,26 @@ class Base(object):
# This information can reduce the size of messages received from sendmail,
# This information can reduce the size of messages received from sendmail,
# and hence could reduce bandwidth between sendmail and your milter where
# and hence could reduce bandwidth between sendmail and your milter where
# that is a factor. The <code>Milter.SETSYMLIST</code> action flag must be
# that is a factor. The <code>Milter.SETSYMLIST</code> action flag must be
# set.
# set. The protocol stages are M_CONNECT, M_HELO, M_ENVFROM, M_ENVRCPT,
# M_DATA, M_EOM, M_EOH.
#
#
# May only be called from negotiate callback.
# May only be called from negotiate callback.
# @since 0.9.
2
,
M_* constants since 0.9.8
# @since 0.9.
8
,
previous version was misspelled!
# @param stage the protocol stage to set to macro list for,
# @param stage the protocol stage to set to macro list for,
# one of the M_* constants defined in Milter
# one of the M_* constants defined in Milter
# @param macros
a string with a space delimited
list of
macro
s
# @param macros
space separated and/or
list
s
of
string
s
def
setsymlist
(
self
,
stage
,
macros
):
def
setsymlist
(
self
,
stage
,
*
macros
):
if
not
self
.
_actions
&
SETSYMLIST
:
raise
DisabledAction
(
"
SETSYMLIST
"
)
if
not
self
.
_actions
&
SETSYMLIST
:
raise
DisabledAction
(
"
SETSYMLIST
"
)
if
type
(
macros
)
!=
str
:
a
=
[]
macros
=
'
'
.
join
(
macros
)
for
m
in
macros
:
return
self
.
_ctx
.
setsmlist
(
stage
,
macros
)
try
:
m
=
m
.
encode
(
'
utf8
'
)
except
:
pass
try
:
m
=
m
.
split
(
'
'
)
except
:
pass
a
+=
m
return
self
.
_ctx
.
setsmlist
(
stage
,
'
'
.
join
(
a
))
# Milter methods which can only be called from eom callback.
# Milter methods which can only be called from eom callback.
...
...
This diff is collapsed.
Click to expand it.
Milter/test.py
+
11
−
3
View file @
bd0df5d7
...
@@ -89,9 +89,17 @@ class TestBase(object):
...
@@ -89,9 +89,17 @@ class TestBase(object):
def
setsymlist
(
self
,
stage
,
macros
):
def
setsymlist
(
self
,
stage
,
macros
):
if
not
self
.
_actions
&
SETSYMLIST
:
raise
DisabledAction
(
"
SETSYMLIST
"
)
if
not
self
.
_actions
&
SETSYMLIST
:
raise
DisabledAction
(
"
SETSYMLIST
"
)
if
type
(
macros
)
!=
str
:
# not used yet, but just for grins we save the data
macros
=
'
'
.
join
(
macros
)
a
=
[]
self
.
_symlist
[
stage
]
=
macros
for
m
in
macros
:
try
:
m
=
m
.
encode
(
'
utf8
'
)
except
:
pass
try
:
m
=
m
.
split
(
'
'
)
except
:
pass
a
+=
m
self
.
_symlist
[
stage
]
=
set
(
a
)
## Feed a file like object to the milter. Calls envfrom, envrcpt for
## Feed a file like object to the milter. Calls envfrom, envrcpt for
# each recipient, header for each header field, body for each body
# each recipient, header for each header field, body for each body
...
...
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