Package svnmailer :: Package notifier :: Module _base :: Class BaseNotifier
[show private | hide private]
[frames | no frames]

Class BaseNotifier

object --+
         |
        BaseNotifier

Known Subclasses:
CIAXMLRPCNotifier, TextNotifier

Base class for notifiers

Custom notifiers must implement this interface (that is just the run method, however).

Additionally it contains some useful utility methods, which can be used.


Method Summary
  __init__(self, settings, groupset)
Initialization
str _getContentEncoding(self, path, revision)
Returns the encoding for the specified path and revision
tuple dumpContent(self, change, enc, default)
Dump the two revisions of a particular change
str getAuthor(self)
Returns the author of the revision
  getBrowserGenerator(self, config)
Returns the browser generator if any
unicode getContentDiffAction(self, change)
Returns the content diff action for a particular change
str getContentDiffUrl(self, config, change)
Returns the content diff url for a particular change
str getContentEncodingProperty(self, path, revision)
Returns the content encoding property for a path/rev
tuple getContentEncodings(self, change, default)
Returns the encodings of the change content (base and current rev)
svnmailer.differ.* getDiffer(self, command, tags)
Returns the initialized differ
tuple getDiffTokens(self, config)
Returns valid diff tokens and tests
str getEncodingFromMimeType(self, path, revision)
Returns the encoding extracted from svn:mime-type
str getLog(self)
Returns the log entry of the revision
unicode getPropertyDiffAction(self, values)
Returns the property diff action for a particular change
unicode or str getTempDir(self)
Returns the temporary directory
svnmailer.util.TempFile getTempFile(self)
Returns an open temporary file container object
int getTime(self)
Returns the time of the revision in seconds since epoch
str getUrl(self, config)
Returns the revision URL
bool isBinaryProperty(self, values)
Returns if the supplied property seems to be binary
bool isOneLineProperty(self, name, value)
Returns if the supplied property value takes just one line
bool isUTF8Property(self, name)
Returns if the supplied property name represents an UTF-8 property
  run(self)
Runs the notifier
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name...
  __getattribute__(...)
x.__getattribute__('name') <==> x.name...
  __hash__(x)
x.__hash__() <==> hash(x)...
  __reduce__(...)
helper for pickle...
  __reduce_ex__(...)
helper for pickle...
  __repr__(x)
x.__repr__() <==> repr(x)...
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value...
  __str__(x)
x.__str__() <==> str(x)...
    Inherited from type
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T...

Instance Variable Summary
svnmailer.main.GroupSet _groupset: The groupset to process
dict _penc_cache: The (path, rev) -> property encoding cache
svnmailer.settings._base.BaseSettings _settings: The settings to use

Class Variable Summary
tuple _diffable_tests: Maps generate_diffs list entrys to change methods
unicode ADD: "add" token
unicode COPY: "copy" token
unicode DELETE: "delete" token
str ENC_CONFIG: Magic value, meaning that the content encoding should be retrieved from the config
str ENC_DEFAULT: Magic value to determine if the default encoding should be displayed
str ENC_PROPERTY: The property name, where encodings could be stored
unicode MODIFY: "modify" token
unicode NONE: "none" token
unicode PROPCHANGE: "propchange" token

Method Details

__init__(self, settings, groupset)
(Constructor)

Initialization
Parameters:
settings - The settings to use
           (type=svnmailer.settings._base.BaseSettings)
groupset - The groupset to process
           (type=svnmailer.main.GroupSet)
Overrides:
__builtin__.object.__init__

_getContentEncoding(self, path, revision)

Returns the encoding for the specified path and revision
Parameters:
path - The path
           (type=str)
revision - The revision number
           (type=int)
Returns:
The encoding
           (type=str)
Raises:
encodings.exception.LookupError - The specified encoding is not implemented or no encoding was specified

dumpContent(self, change, enc='utf-8', default=False)

Dump the two revisions of a particular change

This dumps the files, not the properties

Parameters:
change - The particular change to process
           (type=svnmailer.subversion.VersionedPathDescriptor)
enc - The file data encoding (The data will be recoded to UTF-8; but by default it isn't recoded, because UTF-8 is assumed)
           (type=str)
default - Return the default encoding (ISO-8859-1) if the determined is None
           (type=bool)
Returns:
Two file container objects plus their recoding state (file1, file2, rec1, rec2), where rec? is either the accompanying original encoding or None
           (type=tuple)

getAuthor(self)

Returns the author of the revision
Returns:
The author or None if there's no author
           (type=str)

getBrowserGenerator(self, config)

Returns the browser generator if any

getContentDiffAction(self, change)

Returns the content diff action for a particular change
Parameters:
change - The particular change to process
           (type=svnmailer.subversion.VersionedPathDescriptor)
Returns:
The diff token or `` None`` if there's nothing to diff
           (type=unicode)

getContentDiffUrl(self, config, change)

Returns the content diff url for a particular change
Parameters:
config - group config
           (type=svnmailer.settings._base.GroupSettingsContainer)
change - The particular change to process
           (type=svnmailer.subversion.VersionedPathDescriptor)
Returns:
The URL or None if there's no base URL configured
           (type=str)

getContentEncodingProperty(self, path, revision)

Returns the content encoding property for a path/rev
Parameters:
path - The path
           (type=str)
revision - The revision number
           (type=int)
Returns:
The encoding or None
           (type=str)

getContentEncodings(self, change, default=None)

Returns the encodings of the change content (base and current rev)
Parameters:
change - The change to process
           (type=svnmailer.subversion.VersionedPathDescriptor)
default - The default encoding, if nothing is specified
           (type=str)
Returns:
The two encodings (('enc1', 'enc2'))
           (type=tuple)

getDiffer(self, command=None, tags=False)

Returns the initialized differ
Parameters:
command - The diff command to use (if any)
           (type=tuple or None)
tags - Should return diff opcodes? (Doesn't work for external differ)
           (type=bool)
Returns:
The differ instance
           (type=svnmailer.differ.*)

getDiffTokens(self, config)

Returns valid diff tokens and tests
Parameters:
config - group config
           (type=svnmailer.settings._base.GroupSettingsContainer)
Returns:
The diff tokens and diffable tests. The first element of the tuple contains a list of diff tokens, the second element the diff tests
           (type=tuple)

getEncodingFromMimeType(self, path, revision)

Returns the encoding extracted from svn:mime-type
Parameters:
path - The path
           (type=str)
revision - The revision number
           (type=int)
Returns:
The encoding or None
           (type=str)

getLog(self)

Returns the log entry of the revision
Returns:
The log entry
           (type=str)

getPropertyDiffAction(self, values)

Returns the property diff action for a particular change
Parameters:
values - The two values of the property
           (type=tuple)
Returns:
The diff token
           (type=unicode)

getTempDir(self)

Returns the temporary directory
Returns:
The directory or None
           (type=unicode or str)

getTempFile(self)

Returns an open temporary file container object
Returns:
The filename and an descriptor
           (type=svnmailer.util.TempFile)

getTime(self)

Returns the time of the revision in seconds since epoch
Returns:
The time
           (type=int)

getUrl(self, config)

Returns the revision URL
Returns:
The URL or None
           (type=str)

isBinaryProperty(self, values)

Returns if the supplied property seems to be binary

Note that is a very rudimentary check, just to not pollute diff output with garbage

Parameters:
values - The value tuple
           (type=tuple)
Returns:
binary property?
           (type=bool)

isOneLineProperty(self, name, value)

Returns if the supplied property value takes just one line
Parameters:
name - Property name
           (type=str)
value - The property value
           (type=str)
Returns:
one line property?
           (type=bool)

isUTF8Property(self, name)

Returns if the supplied property name represents an UTF-8 property
Parameters:
name - The property name
           (type=str)
Returns:
The decision
           (type=bool)

run(self)

Runs the notifier

Instance Variable Details

_groupset

The groupset to process
Type:
svnmailer.main.GroupSet

_penc_cache

The (path, rev) -> property encoding cache
Type:
dict

_settings

The settings to use
Type:
svnmailer.settings._base.BaseSettings

Class Variable Details

_diffable_tests

Maps generate_diffs list entrys to change methods
Type:
tuple
Value:
((u'add', <function addFunc at 0xb7de1bfc>),
 (u'delete', <function delFunc at 0xb7de1c34>),
 (u'copy', <function copyFunc at 0xb7de1c6c>),
 (u'modify', <function modFunc at 0xb7de1ca4>),
 (u'propchange', <function propFunc at 0xb7de1cdc>),
 (u'none', <function noneFunc at 0xb7de1d14>))                         

ADD

"add" token
Type:
unicode
Value:
u'add'                                                                 

COPY

"copy" token
Type:
unicode
Value:
u'copy'                                                                

DELETE

"delete" token
Type:
unicode
Value:
u'delete'                                                              

ENC_CONFIG

Magic value, meaning that the content encoding should be retrieved from the config
Type:
str
Value:
'retrieve encoding from config'                                        

ENC_DEFAULT

Magic value to determine if the default encoding should be displayed
Type:
str
Value:
'show default encoding'                                                

ENC_PROPERTY

The property name, where encodings could be stored
Type:
str
Value:
'svnmailer:content-charset'                                            

MODIFY

"modify" token
Type:
unicode
Value:
u'modify'                                                              

NONE

"none" token
Type:
unicode
Value:
u'none'                                                                

PROPCHANGE

"propchange" token
Type:
unicode
Value:
u'propchange'                                                          

Generated by Epydoc 2.0 on Sun Sep 25 20:49:04 2005 http://epydoc.sf.net