Logo Search packages:      
Sourcecode: zope-cps-localizer version File versions  Download package

def Localizer::Accept::Root::parse (   self,
  accept 
)

From a string formatted as specified in the RFC2616, it builds a data
structure which provides a high level interface to implement language
negotiation.

Reimplemented in Localizer::Accept::AcceptCharset.

Definition at line 93 of file Accept.py.

00093                            :
        """
        From a string formatted as specified in the RFC2616, it builds a data
        structure which provides a high level interface to implement language
        negotiation.
        """
        aux = {}
        for x in accept.split(','):
            x = x.strip()
            x = x.split(';')

            # Get the quality
            if len(x) == 2:
                quality = x[1]            # Get the quality
                quality = quality.strip()
                quality = quality[2:]     # Get the number (remove "q=")
                quality = float(quality)  # Change it to float
            else:
                quality = 1.0

            aux[x[0]] = quality

        return aux

    def __str__(self):


Generated by  Doxygen 1.6.0   Back to index