diff --git a/Milter/__init__.py b/Milter/__init__.py index 85c5ab0e70d9c9706be0866c5fb0973b55debf74..b6ffd258a9c1b07b987e7259ee543393190c2f9e 100755 --- a/Milter/__init__.py +++ b/Milter/__init__.py @@ -185,13 +185,15 @@ def noreply(func): # If some or all of these are unused, the bandwidth can be saved # by listing the ones that are used. # @since 1.0.2 -def symlist(func,*syms): - if func.__name__ not in MACRO_CALLBACKS: - raise ValueError('@symlist applied to non-symlist method: '+func.__name__) +def symlist(*syms): if len(syms) > 5: raise ValueError('@symlist limited to 5 macros by MTA: '+func.__name__) - func._symlist = syms - return func + def setsyms(func): + if func.__name__ not in MACRO_CALLBACKS: + raise ValueError('@symlist applied to non-symlist method: '+func.__name__) + func._symlist = syms + return func + return setsyms ## Disabled action exception. # set_flags() can tell the MTA that this application will not use certain diff --git a/Milter/test.py b/Milter/test.py index c20be6354d4616d2357c5d1de0499760cf137b1a..e73fbb2f0f5cdc1f96e589927ca6561f9d39cf21 100644 --- a/Milter/test.py +++ b/Milter/test.py @@ -120,7 +120,7 @@ class TestBase(object): self._reply = (rcode,xcode) + msg def setsymlist(self,stage,macros): - if not self._actions & SETSYMLIST: + if not self._actions & Milter.SETSYMLIST: raise DisabledAction("SETSYMLIST") if self._stage != -1: raise RuntimeError("setsymlist may only be called from negotiate") @@ -220,6 +220,7 @@ class TestBase(object): def connect(self,host='localhost',helo='spamrelay',ip='1.2.3.4'): self._body = None self._bodyreplaced = False + self._setctx(None) opts = [ Milter.CURR_ACTS,~0,0,0 ] self._stage = -1 rc = self.negotiate(opts) diff --git a/sample.py b/sample.py index 4829397c95c30e8f6f0a71afdfb729b237130b6f..0889c1953a96e50adb2768b3cd79f99c66cf9da8 100644 --- a/sample.py +++ b/sample.py @@ -47,6 +47,7 @@ class sampleMilter(Milter.Milter): self.mailfrom = f self.bodysize = 0 self.user = self.getsymval('{auth_authen}') + self.auth_type = self.getsymval('{auth_type}') if self.user: self.log("user",self.user,"sent mail from",f,str) else: