mailman  2.1.39
About: Mailman 2 - The GNU Mailing List Management System.
  Fossies Dox: mailman-2.1.39.tgz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Mailman.Utils Namespace Reference

Classes

class  OuterExit
 

Functions

def list_exists (listname)
 
def list_names ()
 
def wrap (text, column=70, honor_leading_ws=True)
 
def QuotePeriods (text)
 
def ParseEmail (email)
 
def LCDomain (addr)
 
def ValidateEmail (s)
 
def GetPathPieces (envar='PATH_INFO')
 
def GetRequestMethod ()
 
def ScriptURL (target, web_page_url=None, absolute=False)
 
def GetPossibleMatchingAddrs (name)
 
def List2Dict (L, foldcase=False)
 
def UserFriendly_MakeRandomPassword (length)
 
def Secure_MakeRandomPassword (length)
 
def MakeRandomPassword (length=mm_cfg.MEMBER_PASSWORD_LENGTH)
 
def GetRandomSeed ()
 
def set_global_password (pw, siteadmin=True)
 
def get_global_password (siteadmin=True)
 
def check_global_password (response, siteadmin=True)
 
def websafe (s, doubleescape=False)
 
def nntpsplit (s)
 
def ObscureEmail (addr, for_text=False)
 
def UnobscureEmail (addr)
 
def findtext (templatefile, dict=None, raw=False, lang=None, mlist=None)
 
def maketext (templatefile, dict=None, raw=False, lang=None, mlist=None)
 
def is_administrivia (msg)
 
def GetRequestURI (fallback=None, escape=True)
 
def reap (kids, func=None, once=False)
 
def GetLanguageDescr (lang)
 
def GetCharSet (lang)
 
def GetDirection (lang)
 
def IsLanguage (lang)
 
def get_domain ()
 
def get_site_email (hostname=None, extra=None)
 
def unique_message_id (mlist)
 
def midnight (date=None)
 
def to_dollar (s)
 
def to_percent (s)
 
def dollar_identifiers (s)
 
def percent_identifiers (s)
 
def canonstr (s, lang=None)
 
def uncanonstr (s, lang=None)
 
def uquote (s)
 
def oneline (s, cset)
 
def strip_verbose_pattern (pattern)
 

Variables

string _lower = 'abcdefghijklmnopqrstuvwxyz'
 
string ascii_letters = _lower + _lower.upper()
 
 md5_new = hashlib.md5
 
 sha_new = hashlib.sha1
 
int True = 1
 
int False = 0
 
bool dns_resolver = True
 
bool have_ipaddress = True
 
string EMPTYSTRING = ''
 
string UEMPTYSTRING = u''
 
string CR = '\r'
 
string NL = '\n'
 
string DOT = '.'
 
string IDENTCHARS = ascii_letters + digits + '_'
 
 cre = re.compile(r'%\‍(([_a-z]\w*?)\‍)s?', re.IGNORECASE)
 
 dre = re.compile(r'(\${2})|\$([_a-z]\w*)|\${([_a-z]\w*)}', re.IGNORECASE)
 
 _badchars = re.compile(r'[][()<>|:;^,\\"\000-\037\177-\377]')
 
 _valid_domain = re.compile('[-a-z0-9]', re.IGNORECASE)
 
 CRNLpat = re.compile(r'[^\x21-\x7e]')
 
tuple _vowels = ('a', 'e', 'i', 'o', 'u')
 
tuple _consonants
 
list _syllables = []
 
 _ampre = re.compile('&amp;((?:#[0-9]+|[a-z]+);)', re.IGNORECASE)
 
dictionary ADMINDATA
 
int _serial = 0
 

Function Documentation

◆ canonstr()

def Mailman.Utils.canonstr (   s,
  lang = None 
)

Definition at line 890 of file Utils.py.

References Mailman.Utils.GetCharSet().

◆ check_global_password()

def Mailman.Utils.check_global_password (   response,
  siteadmin = True 
)

Definition at line 483 of file Utils.py.

References Mailman.Utils.get_global_password(), and Mailman.Utils.sha_new.

◆ dollar_identifiers()

def Mailman.Utils.dollar_identifiers (   s)
Return the set (dictionary) of identifiers found in a $-string.

Definition at line 871 of file Utils.py.

◆ findtext()

def Mailman.Utils.findtext (   templatefile,
  dict = None,
  raw = False,
  lang = None,
  mlist = None 
)

Definition at line 549 of file Utils.py.

Referenced by Mailman.Utils.maketext().

◆ get_domain()

def Mailman.Utils.get_domain ( )

◆ get_global_password()

def Mailman.Utils.get_global_password (   siteadmin = True)

Definition at line 467 of file Utils.py.

Referenced by Mailman.Utils.check_global_password().

◆ get_site_email()

def Mailman.Utils.get_site_email (   hostname = None,
  extra = None 
)

Definition at line 802 of file Utils.py.

References Mailman.Utils.get_domain().

◆ GetCharSet()

def Mailman.Utils.GetCharSet (   lang)

Definition at line 774 of file Utils.py.

Referenced by Mailman.Utils.canonstr(), and Mailman.Utils.uncanonstr().

◆ GetDirection()

def Mailman.Utils.GetDirection (   lang)

Definition at line 777 of file Utils.py.

◆ GetLanguageDescr()

def Mailman.Utils.GetLanguageDescr (   lang)

Definition at line 770 of file Utils.py.

◆ GetPathPieces()

def Mailman.Utils.GetPathPieces (   envar = 'PATH_INFO')

◆ GetPossibleMatchingAddrs()

def Mailman.Utils.GetPossibleMatchingAddrs (   name)
returns a sorted list of addresses that could possibly match
a given name.

For Example, given scott@pobox.com, return ['scott@pobox.com'],
given scott@blackbox.pobox.com return ['scott@blackbox.pobox.com',
                                       'scott@pobox.com']

Definition at line 348 of file Utils.py.

References Mailman.Utils.ParseEmail().

◆ GetRandomSeed()

def Mailman.Utils.GetRandomSeed ( )

Definition at line 438 of file Utils.py.

◆ GetRequestMethod()

def Mailman.Utils.GetRequestMethod ( )

Definition at line 314 of file Utils.py.

◆ GetRequestURI()

def Mailman.Utils.GetRequestURI (   fallback = None,
  escape = True 
)
Return the full virtual path this CGI script was invoked with.

Newer web servers seems to supply this info in the REQUEST_URI
environment variable -- which isn't part of the CGI/1.1 spec.
Thus, if REQUEST_URI isn't available, we concatenate SCRIPT_NAME
and PATH_INFO, both of which are part of CGI/1.1.

Optional argument `fallback' (default `None') is returned if both of
the above methods fail.

The url will be cgi escaped to prevent cross-site scripting attacks,
unless `escape' is set to 0.

Definition at line 722 of file Utils.py.

References Mailman.Utils.websafe().

◆ is_administrivia()

def Mailman.Utils.is_administrivia (   msg)

Definition at line 683 of file Utils.py.

◆ IsLanguage()

def Mailman.Utils.IsLanguage (   lang)

Definition at line 780 of file Utils.py.

◆ LCDomain()

def Mailman.Utils.LCDomain (   addr)

Definition at line 232 of file Utils.py.

◆ List2Dict()

def Mailman.Utils.List2Dict (   L,
  foldcase = False 
)
Return a dict keyed by the entries in the list passed to it.

Definition at line 368 of file Utils.py.

◆ list_exists()

def Mailman.Utils.list_exists (   listname)
Return true iff list `listname' exists.

Definition at line 103 of file Utils.py.

References Mailman.Logging.Syslog.syslog.

Referenced by Mailman.Site.get_listnames().

◆ list_names()

def Mailman.Utils.list_names ( )
Return the names of all lists in default list directory.

Definition at line 129 of file Utils.py.

Referenced by Mailman.Utils.GetPathPieces().

◆ MakeRandomPassword()

def Mailman.Utils.MakeRandomPassword (   length = mm_cfg.MEMBER_PASSWORD_LENGTH)

◆ maketext()

def Mailman.Utils.maketext (   templatefile,
  dict = None,
  raw = False,
  lang = None,
  mlist = None 
)

Definition at line 660 of file Utils.py.

References Mailman.Utils.findtext().

◆ midnight()

def Mailman.Utils.midnight (   date = None)

Definition at line 830 of file Utils.py.

◆ nntpsplit()

def Mailman.Utils.nntpsplit (   s)

Definition at line 514 of file Utils.py.

◆ ObscureEmail()

def Mailman.Utils.ObscureEmail (   addr,
  for_text = False 
)
Make email address unrecognizable to web spiders, but invertable.

When for_text option is set (not default), make a sentence fragment
instead of a token.

Definition at line 528 of file Utils.py.

◆ oneline()

def Mailman.Utils.oneline (   s,
  cset 
)

Definition at line 970 of file Utils.py.

Referenced by Mailman.Handlers.MimeDel.get_file_ext().

◆ ParseEmail()

def Mailman.Utils.ParseEmail (   email)

◆ percent_identifiers()

def Mailman.Utils.percent_identifiers (   s)
Return the set (dictionary) of identifiers found in a %-string.

Definition at line 879 of file Utils.py.

◆ QuotePeriods()

def Mailman.Utils.QuotePeriods (   text)

Definition at line 212 of file Utils.py.

◆ reap()

def Mailman.Utils.reap (   kids,
  func = None,
  once = False 
)

Definition at line 748 of file Utils.py.

◆ ScriptURL()

def Mailman.Utils.ScriptURL (   target,
  web_page_url = None,
  absolute = False 
)
target - scriptname only, nothing extra
web_page_url - the list's configvar of the same name
absolute - a flag which if set, generates an absolute url

Definition at line 319 of file Utils.py.

References Mailman.Utils.get_domain().

◆ Secure_MakeRandomPassword()

def Mailman.Utils.Secure_MakeRandomPassword (   length)

◆ set_global_password()

def Mailman.Utils.set_global_password (   pw,
  siteadmin = True 
)

Definition at line 452 of file Utils.py.

References Mailman.Utils.sha_new.

◆ strip_verbose_pattern()

def Mailman.Utils.strip_verbose_pattern (   pattern)

◆ to_dollar()

def Mailman.Utils.to_dollar (   s)
Convert from %-strings to $-strings.

Definition at line 845 of file Utils.py.

◆ to_percent()

def Mailman.Utils.to_percent (   s)
Convert from $-strings to %-strings.

Definition at line 857 of file Utils.py.

◆ uncanonstr()

def Mailman.Utils.uncanonstr (   s,
  lang = None 
)

Definition at line 937 of file Utils.py.

References Mailman.Utils.GetCharSet(), and Mailman.Utils.uquote().

◆ unique_message_id()

def Mailman.Utils.unique_message_id (   mlist)

Definition at line 819 of file Utils.py.

Referenced by Mailman.Handlers.Cleanse.process().

◆ UnobscureEmail()

def Mailman.Utils.UnobscureEmail (   addr)
Invert ObscureEmail() conversion.

Definition at line 538 of file Utils.py.

Referenced by Mailman.CSRFcheck.csrf_check(), and Mailman.CSRFcheck.csrf_token().

◆ uquote()

def Mailman.Utils.uquote (   s)

Definition at line 958 of file Utils.py.

Referenced by Mailman.Utils.uncanonstr().

◆ UserFriendly_MakeRandomPassword()

def Mailman.Utils.UserFriendly_MakeRandomPassword (   length)

◆ ValidateEmail()

def Mailman.Utils.ValidateEmail (   s)
Verify that an email address isn't grossly evil.

Definition at line 247 of file Utils.py.

References Mailman.Utils.ParseEmail().

◆ websafe()

def Mailman.Utils.websafe (   s,
  doubleescape = False 
)

◆ wrap()

def Mailman.Utils.wrap (   text,
  column = 70,
  honor_leading_ws = True 
)
Wrap and fill the text to the specified column.

Wrapping is always in effect, although if it is not possible to wrap a
line (because some word is longer than `column' characters) the line is
broken at the next available whitespace boundary.  Paragraphs are also
always filled, unless honor_leading_ws is true and the line begins with
whitespace.  This is the algorithm that the Python FAQ wizard uses, and
seems like a good compromise.

Definition at line 137 of file Utils.py.

Variable Documentation

◆ _ampre

Mailman.Utils._ampre = re.compile('&amp;((?:#[0-9]+|[a-z]+);)', re.IGNORECASE)
private

Definition at line 491 of file Utils.py.

◆ _badchars

Mailman.Utils._badchars = re.compile(r'[][()<>|:;^,\\"\000-\037\177-\377]')
private

Definition at line 241 of file Utils.py.

◆ _consonants

tuple Mailman.Utils._consonants
private
Initial value:
1= ('b', 'c', 'd', 'f', 'g', 'h', 'k', 'm', 'n',
2 'p', 'r', 's', 't', 'v', 'w', 'x', 'z')

Definition at line 382 of file Utils.py.

◆ _lower

string Mailman.Utils._lower = 'abcdefghijklmnopqrstuvwxyz'
private

Definition at line 50 of file Utils.py.

◆ _serial

int Mailman.Utils._serial = 0
private

Definition at line 818 of file Utils.py.

◆ _syllables

list Mailman.Utils._syllables = []
private

Definition at line 384 of file Utils.py.

◆ _valid_domain

Mailman.Utils._valid_domain = re.compile('[-a-z0-9]', re.IGNORECASE)
private

Definition at line 245 of file Utils.py.

◆ _vowels

tuple Mailman.Utils._vowels = ('a', 'e', 'i', 'o', 'u')
private

Definition at line 381 of file Utils.py.

◆ ADMINDATA

dictionary Mailman.Utils.ADMINDATA
Initial value:
1= {
2 # admin keyword: (minimum #args, maximum #args)
3 'confirm': (1, 1),
4 'help': (0, 0),
5 'info': (0, 0),
6 'lists': (0, 0),
7 'options': (0, 0),
8 'password': (2, 2),
9 'remove': (0, 0),
10 'set': (3, 3),
11 'subscribe': (0, 3),
12 'unsubscribe': (0, 1),
13 'who': (0, 1),
14 }

Definition at line 665 of file Utils.py.

◆ ascii_letters

string Mailman.Utils.ascii_letters = _lower + _lower.upper()

Definition at line 51 of file Utils.py.

◆ CR

string Mailman.Utils.CR = '\r'

Definition at line 90 of file Utils.py.

◆ cre

Mailman.Utils.cre = re.compile(r'%\‍(([_a-z]\w*?)\‍)s?', re.IGNORECASE)

Definition at line 97 of file Utils.py.

◆ CRNLpat

Mailman.Utils.CRNLpat = re.compile(r'[^\x21-\x7e]')

Definition at line 278 of file Utils.py.

◆ dns_resolver

bool Mailman.Utils.dns_resolver = True

Definition at line 78 of file Utils.py.

◆ DOT

string Mailman.Utils.DOT = '.'

Definition at line 92 of file Utils.py.

◆ dre

Mailman.Utils.dre = re.compile(r'(\${2})|\$([_a-z]\w*)|\${([_a-z]\w*)}', re.IGNORECASE)

Definition at line 99 of file Utils.py.

◆ EMPTYSTRING

string Mailman.Utils.EMPTYSTRING = ''

Definition at line 88 of file Utils.py.

◆ False

int Mailman.Utils.False = 0

Definition at line 73 of file Utils.py.

◆ have_ipaddress

bool Mailman.Utils.have_ipaddress = True

Definition at line 84 of file Utils.py.

◆ IDENTCHARS

string Mailman.Utils.IDENTCHARS = ascii_letters + digits + '_'

Definition at line 93 of file Utils.py.

◆ md5_new

Mailman.Utils.md5_new = hashlib.md5

Definition at line 61 of file Utils.py.

Referenced by Mailman.SecurityManager.SecurityManager.Authenticate().

◆ NL

string Mailman.Utils.NL = '\n'

Definition at line 91 of file Utils.py.

◆ sha_new

◆ True

int Mailman.Utils.True = 1

Definition at line 72 of file Utils.py.

◆ UEMPTYSTRING

string Mailman.Utils.UEMPTYSTRING = u''

Definition at line 89 of file Utils.py.