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
de679b15
Commit
de679b15
authored
14 years ago
by
Stuart Gathman
Browse files
Options
Downloads
Patches
Plain Diff
Add parameterless class decorators for P_RCPT_REJ and P_HEAD_LEADSPC
parent
b9467598
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
Milter/__init__.py
+44
-14
44 additions, 14 deletions
Milter/__init__.py
doc/milter.py
+4
-1
4 additions, 1 deletion
doc/milter.py
with
48 additions
and
15 deletions
Milter/__init__.py
+
44
−
14
View file @
de679b15
...
...
@@ -19,6 +19,12 @@ from milter import *
_seq_lock
=
thread
.
allocate_lock
()
_seq
=
0
## @fn set_flags(flags)
# @brief Enable optional %milter actions.
# Certain %milter actions need to be enabled before calling milter.runmilter()
# or they throw an exception.
# @param flags Bit ored mask of optional actions to enable
def
uniqueID
():
"""
Return a unique sequence number (incremented on each call).
"""
...
...
@@ -49,13 +55,6 @@ def decode_mask(bits,names):
if
bits
:
nms
+=
hex
(
bits
)
return
nms
## @fn set_flags(flags)
# @brief Enable optional %milter actions.
# Certain %milter actions need to be enabled before calling milter.runmilter()
# or they throw an exception.
# @param flags Bit ored mask of optional actions to enable
## Class decorator to enable optional protocol steps.
# P_SKIP is enabled by default when supported, but
# applications may wish to enable P_HDR_LEADSPC
...
...
@@ -77,13 +76,6 @@ def decode_mask(bits,names):
# return Milter.CONTINUE
# myMilter = Milter.enable_protocols(myMilter,Milter.P_RCPT_REJ)
# </pre>
# or with python-2.6 and later:
# <pre>
# @@Milter.enable_protocols(Milter.P_RCPT_REJ)
# class myMilter(Milter.Base):
# def envrcpt(self,to,*params):
# return Milter.CONTINUE
# </pre>
# @since 0.9.3
# @param klass the %milter application class to modify
# @param mask a bitmask of protocol steps to enable
...
...
@@ -92,6 +84,44 @@ def enable_protocols(klass,mask):
klass
.
_protocol_mask
=
klass
.
protocol_mask
()
&
~
mask
return
klass
## Milter rejected recipients. A class decorator that calls
# enable_protocols() with the P_RCPT_REJ flag. By default, the MTA
# does not pass recipients that it knows are invalid on to the milter.
# This decorator enables a %milter app to see all recipients if supported
# by the MTA. Use like this with python-2.6 and later:
# <pre>
# @@Milter.rejected_recipients
# class myMilter(Milter.Base):
# def envrcpt(self,to,*params):
# return Milter.CONTINUE
# </pre>
# @since 0.9.5
# @param klass the %milter application class to modify
# @return the modified %milter class
def
rejected_recipients
(
klass
):
return
enable_protocols
(
klass
,
P_RCPT_REJ
)
## Milter leading space on headers. A class decorator that calls
# enable_protocols() with the P_HEAD_LEADSPC flag. By default,
# header continuation lines are collected and joined before getting
# sent to a milter. Headers modified or added by the milter are
# folded by the MTA as necessary according to its own standards.
# With this flag, header continuation lines are preserved
# with their newlines and leading space. In addition, header folding
# done by the milter is preserved as well.
# Use like this with python-2.6 and later:
# <pre>
# @@Milter.header_leading_space
# class myMilter(Milter.Base):
# def header(self,hname,value):
# return Milter.CONTINUE
# </pre>
# @since 0.9.5
# @param klass the %milter application class to modify
# @return the modified %milter class
def
header_leading_space
(
klass
):
return
enable_protocols
(
klass
,
P_HEAD_LEADSPC
)
## Function decorator to disable callback methods.
# If the MTA supports it, tells the MTA not to invoke this callback,
# increasing efficiency. All the callbacks (except negotiate)
...
...
This diff is collapsed.
Click to expand it.
doc/milter.py
+
4
−
1
View file @
de679b15
...
...
@@ -22,7 +22,10 @@
class
milterContext
(
object
):
## Calls <a href="https://www.milter.org/developers/api/smfi_getsymval">smfi_getsymval</a>.
def
getsymval
(
self
,
sym
):
pass
## Calls <a href="https://www.milter.org/developers/api/smfi_setreply">smfi_setreply</a>.
## Calls <a href="https://www.milter.org/developers/api/smfi_setreply">
# smfi_setreply</a> or
# <a href="https://www.milter.org/developers/api/smfi_setmlreply">
# smfi_setmlreply</a>.
# @param rcode SMTP response code
# @param xcode extended SMTP response code
# @param msg one or more message lines. If the MTA does not support
...
...
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