Package peppy :: Package vfs :: Package itools :: Package uri :: Module generic
[frames] | no frames]

Module generic

This module aims to implement the URI standard as specified by RFC2396, see http://www.ietf.org/rfc/rfc2396.txt

Other related RFCs include:

Classes
  Authority
There are two types of authorities: registry based and server-based; right now only server-based are supported (XXX).
  Segment
  USegment
  Path
A path is a sequence of segments.
  Reference
A common URI reference is made of five components:
  EmptyReference
  GenericDataType
Functions
 
normalize_path(path)
Normalize the path (we don't use os.path because on Windows it converts forward slashes to back slashes).
 
decode_query(data)
Decodes a query as defined by the "application/x-www-form-urlencoded" content type.
 
encode_query(query)
This method encodes a query as defined by the "application/x-www-form-urlencoded" content type (see http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1 for details)
Function Details

normalize_path(path)

 

Normalize the path (we don't use os.path because on Windows it
converts forward slashes to back slashes).

Examples:

  'a//b/c'     -> 'a/b/c'
  'a/./b/c'    -> 'a/b/c'
  'a/b/c/../d' -> 'a/b/d'
  '/../a/b/c ' -> '/a/b/c'
  '.'          -> ''

decode_query(data)

 

Decodes a query as defined by the "application/x-www-form-urlencoded" content type.

The value expected is a byte string like "a=1&b=2"; the value returned is a dictonary like {'a': 1, 'b': 2}.

See http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1 for details.

encode_query(query)

 

This method encodes a query as defined by the "application/x-www-form-urlencoded" content type (see http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1 for details)

The value expected is a dictonary like {'a': 1, 'b': 2}. The value returned is a byte string like "a=1&b=2".