pyweblib.helper (version 0.2.0)
index
/usr/lib/python2.1/site-packages/pyweblib/helper.py

pyweblib.helper - Misc. stuff useful in CGI-BINs
(c) by Michael Stroeder <michael@stroeder.com>

 
Modules
            
UserDict
os
re
string
sys

 
Classes
            
UserDict.UserDict
AcceptCharsetDict

 
class AcceptCharsetDict(UserDict.UserDict)
      This dictionary class is used to determine the character
set capabilities of a browser by parsing HTTP header
Accept-Charset.
 
See RFC2616 section "14.2 Accept-Charset".
 
  
__cmp__(self, dict) from UserDict.UserDict
__delitem__(self, key) from UserDict.UserDict
__getitem__(self, charset)
charset
    String representing the name of the charset for which to return
    the floating point capability value (see RFC2616, section 3.4).
__init__(self, env={'PAGER': 'less', 'LS_COLORS': 'no=00:fi=00:di=0...PYCALIB': '/home/michael/Proj/python/pyca/pylib'})
Parse the HTTP_ACCEPT_CHARSET env var into an internal
dictionary.
 
env
    dictionary holding environment vars
__len__(self) from UserDict.UserDict
__repr__(self) from UserDict.UserDict
__setitem__(self, key, item) from UserDict.UserDict
clear(self) from UserDict.UserDict
copy(self) from UserDict.UserDict
get(self, key, failobj=None) from UserDict.UserDict
has_key(self, key) from UserDict.UserDict
items(self) from UserDict.UserDict
keys(self) from UserDict.UserDict
popitem(self) from UserDict.UserDict
preferredCharset(self, defaultCharset=None)
Return the charset name with highest capabilty weigth
 
defaultCharset
    If not None and '*' would be the result this charset name
    is returned instead of '*'.
setdefault(self, key, failobj=None) from UserDict.UserDict
update(self, dict) from UserDict.UserDict
values(self) from UserDict.UserDict

 
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.1/site-packages/pyweblib/helper.pyc'
__name__ = 'pyweblib.helper'
__version__ = '0.2.0'
b = 'NCSA_Mosaic'
compatible_browsers = ['NetPositive', 'MSIE', 'StarOffice', 'Opera', 'Lynx', 'NCSA_Mosaic']
compatible_browsers_re = <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_Pattern object>