pyweblib.helper (version 0.3.0)
index
/usr/lib/python2.2/site-packages/pyweblib/helper.py

pyweblib.helper - Misc. stuff useful in CGI-BINs
(c) by Michael Stroeder <michael@stroeder.com>
 
This module is distributed under the terms of the
GPL (GNU GENERAL PUBLIC LICENSE) Version 2
(see http://www.gnu.org/copyleft/gpl.html)
 
$Id: pyweblib.helper.html,v 1.6 2002/02/01 12:57:21 michael Exp $

 
Modules
            
UserDict
os
re
string
sys
 
Classes
            
UserDict.UserDict
AcceptHeaderDict
AcceptCharsetDict
 
class AcceptCharsetDict(AcceptHeaderDict)
      Special class for Accept-Charset header
 
  
Method resolution order:
AcceptCharsetDict
AcceptHeaderDict
UserDict.UserDict

Methods defined here:
__init__(self, envKey, env={'TMP': '/home/michael/tmp', 'PYCALIB': '/home/m...e-linux', 'PAGER': 'less', 'LC_COLLATE': 'POSIX'}, defaultValue='utf-8')
preferred(self)
Return the value name with highest capability weigth

Data and non-method functions defined here:
__doc__ = '\n Special class for Accept-Charset header\n '
__module__ = 'pyweblib.helper'

Methods inherited from AcceptHeaderDict:
__getitem__(self, value)
value
    String representing the value for which to return
    the floating point capability weight.
items(self)
Return the accepted values as tuples (value,weigth)
in descending order of capability weight
keys(self)
Return the accepted values in descending order of capability weight

Methods inherited from UserDict.UserDict:
__cmp__(self, dict)
__contains__(self, key)
__delitem__(self, key)
__len__(self)
__repr__(self)
__setitem__(self, key, item)
clear(self)
copy(self)
get(self, key, failobj=None)
has_key(self, key)
iteritems(self)
iterkeys(self)
itervalues(self)
popitem(self)
setdefault(self, key, failobj=None)
update(self, dict)
values(self)
 
class AcceptHeaderDict(UserDict.UserDict)
      This dictionary class is used to parse
Accept-header lines with quality weights.
 
It's a base class for all Accept-* headers described
in sections 14.1 to 14.5 of RFC2616.
 
   Methods defined here:
__getitem__(self, value)
value
    String representing the value for which to return
    the floating point capability weight.
__init__(self, envKey, env={'TMP': '/home/michael/tmp', 'PYCALIB': '/home/m...e-linux', 'PAGER': 'less', 'LC_COLLATE': 'POSIX'}, defaultValue=None)
Parse the Accept-* header line.
 
httpHeader
    string with value of Accept-* header line
items(self)
Return the accepted values as tuples (value,weigth)
in descending order of capability weight
keys(self)
Return the accepted values in descending order of capability weight

Data and non-method functions defined here:
__doc__ = '\n This dictionary class is used to parse\n A...ibed\n in sections 14.1 to 14.5 of RFC2616.\n '
__module__ = 'pyweblib.helper'

Methods inherited from UserDict.UserDict:
__cmp__(self, dict)
__contains__(self, key)
__delitem__(self, key)
__len__(self)
__repr__(self)
__setitem__(self, key, item)
clear(self)
copy(self)
get(self, key, failobj=None)
has_key(self, key)
iteritems(self)
iterkeys(self)
itervalues(self)
popitem(self)
setdefault(self, key, failobj=None)
update(self, dict)
values(self)
 
Functions
            
BrowserType(http_user_agent)
Parse the HTTP_USER_AGENT environment variable and return the
tuple (Browser,Version).
 
Not sure if this succeeds in every situation since most
browsers have very obscure HTTP_USER_AGENT entries for compability reasons.
The following browsers are known by name:
Netscape      Netscape Navigator, Netscape Communicator)
MSIE          MS Internet Explorer
Opera         Opera browser from http://www.operasoftware.com/
StarOffice    built-in browser of Star Office
Lynx          the text-based browser Lynx
NetPositive   Net Positive (BeOS)
 
Data
             __file__ = '/usr/lib/python2.2/site-packages/pyweblib/helper.pyc'
__name__ = 'pyweblib.helper'
__version__ = '0.3.0'
b = 'NetPositive'
compatible_browsers = ['Lynx', 'NCSA_Mosaic', 'Opera', 'StarOffice', 'MSIE', 'NetPositive']
compatible_browsers_re = <_sre.SRE_Pattern object>
known_browsers = {'Lynx': 'Lynx', 'MSIE': 'Microsoft Internet Explorer', 'Mozilla': 'Netscape Navigator', 'NCSA_Mosaic': 'NCSA Mosaic', 'NetPositive': 'Net Positive', 'Opera': 'Opera', 'StarOffice': 'StarOffice'}
known_browsers_rev = {'Lynx': 'Lynx', 'Microsoft Internet Explorer': 'MSIE', 'NCSA Mosaic': 'NCSA_Mosaic', 'Net Positive': 'NetPositive', 'Netscape Navigator': 'Mozilla', 'Opera': 'Opera', 'StarOffice': 'StarOffice'}
mozilla_re = <_sre.SRE_Pattern object>