Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Static Private Attributes
MoinMoin.support.werkzeug.useragents.UserAgent Class Reference

List of all members.

Public Member Functions

def __init__
def to_header
def __str__
def __nonzero__
def __repr__

Public Attributes

 string
 language

Static Private Attributes

tuple _parser = UserAgentParser()

Detailed Description

Represents a user agent.  Pass it a WSGI environment or a user agent
string and you can inspect some of the details from the user agent
string via the attributes.  The following attributes exist:

.. attribute:: string

   the raw user agent string

.. attribute:: platform

   the browser platform.  The following platforms are currently
   recognized:

   -   `aix`
   -   `amiga`
   -   `android`
   -   `bsd`
   -   `hpux`
   -   `iphone`
   -   `irix`
   -   `linux`
   -   `macos`
   -   `sco`
   -   `solaris`
   -   `wii`
   -   `windows`

.. attribute:: browser

    the name of the browser.  The following browsers are currently
    recognized:

    -   `aol` *
    -   `ask` *
    -   `camino`
    -   `chrome`
    -   `firefox`
    -   `galeon`
    -   `google` *
    -   `kmeleon`
    -   `konqueror`
    -   `links`
    -   `lynx`
    -   `msie`
    -   `msn`
    -   `netscape`
    -   `opera`
    -   `safari`
    -   `seamonkey`
    -   `webkit`
    -   `yahoo` *

    (Browsers maked with a star (``*``) are crawlers.)

.. attribute:: version

    the version of the browser

.. attribute:: language

    the language of the browser

Definition at line 90 of file useragents.py.


Constructor & Destructor Documentation

def MoinMoin.support.werkzeug.useragents.UserAgent.__init__ (   self,
  environ_or_string 
)

Definition at line 155 of file useragents.py.

00155 
00156     def __init__(self, environ_or_string):
00157         if isinstance(environ_or_string, dict):
00158             environ_or_string = environ_or_string.get('HTTP_USER_AGENT', '')
00159         self.string = environ_or_string
00160         self.platform, self.browser, self.version, self.language = \
00161             self._parser(environ_or_string)


Member Function Documentation

Definition at line 168 of file useragents.py.

00168 
00169     def __nonzero__(self):
00170         return bool(self.browser)

Definition at line 171 of file useragents.py.

00171 
00172     def __repr__(self):
00173         return '<%s %r/%s>' % (
00174             self.__class__.__name__,
00175             self.browser,
00176             self.version
00177         )
00178 
00179 
00180 # conceptionally this belongs in this module but because we want to lazily
00181 # load the user agent module (which happens in wrappers.py) we have to import
00182 # it afterwards.  The class itself has the module set to this module so
00183 # pickle, inspect and similar modules treat the object as if it was really
# implemented here.

Definition at line 165 of file useragents.py.

00165 
00166     def __str__(self):
00167         return self.string

Definition at line 162 of file useragents.py.

00162 
00163     def to_header(self):
00164         return self.string


Member Data Documentation

Definition at line 153 of file useragents.py.

Definition at line 159 of file useragents.py.

Definition at line 158 of file useragents.py.


The documentation for this class was generated from the following file: