Package backend :: Package common :: Module rhnLib
[hide private]
[frames] | no frames]

Module rhnLib

source code

Classes [hide private]
  UTC
Used for creating offset-aware datetime objects in Python 2.
Functions [hide private]
 
setHeaderValue(mp_table, name, values)
Function that correctly sets headers in an Apache-like table The values may be a string (which are set as for a dictionary), or an array.
source code
 
rfc822time(arg)
Return time as a string formatted such as: 'Wed, 23 Jun 2001 23:08:35 GMT'.
source code
 
timestamp(s)
Converts the string in format YYYYMMDDHHMISS to seconds from the epoch
source code
 
checkValue(val, *args)
A type/value checker Check value against the list of acceptable values / types
source code
 
parseUrl(url)
urlparse is more complicated than what we need.
source code
 
hash_object_id(object_id, factor)
Given an object id (assumed to be <label>-<number>), returns the last few digits for the number.
source code
 
parseRPMName(pkgName)
IN: Package string in, n-n-n-v.v.v-r.r_r, format.
source code
 
parseDEBName(pkgName)
IN: Package string in, n-n_v.v-v.v-r.r, format.
source code
 
isSUSE()
Return true if this is a SUSE system, otherwise false
source code
Variables [hide private]
  rfc822_days = ('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun')
  rfc822_mons = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'...
  re_rpmName = re.compile(r'^(.*)-([^-]*)-([^-]*)$')
  utc = UTC()
  __package__ = 'backend.common'
Function Details [hide private]

rfc822time(arg)

source code 

Return time as a string formatted such as: 'Wed, 23 Jun 2001 23:08:35 GMT'.
We must not use locale-specific functions such as strftime here because
the RFC explicitly requires C-locale only formatting.  To satisfy this
requirement, we declare our own days and months here and do the formatting
manually.

This function accepts a single argument.  If it is a List or Tuple type,
it is assumed to be of the form struct_time, as specified in the Python
time module reference.  If the argument is a float, it is expected to be
the number of seconds from the epoch.

NOTE:  In all cases, the argument is assumed to be in local time.  It will
       be translated to GMT in the return value.

parseUrl(url)

source code 
urlparse is more complicated than what we need.

We make the assumption that the URL has real URL information.
NOTE: http/https ONLY for right now.

The normal behavior of urlparse:
    - if no {http[s],file}:// then the string is considered everything
      that normally follows the URL, e.g. /XMLRPC
    - if {http[s],file}:// exists, anything between that and the next /
      is the URL.

The behavior of *this* function:
    - if no {http[s],file}:// then the string is simply assumed to be a
      URL without the {http[s],file}:// attached. The parsed info is
      reparsed as one would think it would be:

    - returns: (addressing scheme, network location, path,
                parameters, query, fragment identifier).

      NOTE: netloc (or network location) can be HOSTNAME:PORT

hash_object_id(object_id, factor)

source code 

Given an object id (assumed to be <label>-<number>), returns the last few digits for the number. For instance, (812345, 3) should return 345

parseRPMName(pkgName)

source code 

IN: Package string in, n-n-n-v.v.v-r.r_r, format. OUT: Four strings (in a tuple): name, epoch, version, release.

parseDEBName(pkgName)

source code 

IN: Package string in, n-n_v.v-v.v-r.r, format. OUT: Four strings (in a tuple): name, epoch, version, release.


Variables Details [hide private]

rfc822_mons

Value:
('Jan',
 'Feb',
 'Mar',
 'Apr',
 'May',
 'Jun',
 'Jul',
 'Aug',
...