Package svnmailer :: Package notifier :: Module _base :: Class BaseNotifier
[hide private]

Class BaseNotifier

source code

object --+
         |
        BaseNotifier
Known Subclasses:

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.

Instance Methods [hide private]
 
__init__(self, settings, groupset)
Initialization
source code
str
_getContentEncoding(self, path, revision)
Returns the encoding for the specified path and revision
source code
tuple
dumpContent(self, change, enc='utf-8', default=False)
Dump the two revisions of a particular change
source code
str
getAuthor(self)
Returns the author of the revision
source code
unicode
getContentDiffAction(self, change)
Returns the content diff action for a particular change
source code
str
getContentDiffUrl(self, config, change)
Returns the content diff url for a particular change
source code
str
getContentEncodingProperty(self, path, revision)
Returns the content encoding property for a path/rev
source code
tuple of str
getContentEncodings(self, change, default=None)
Returns the encodings of the change content (base and current rev)
source code
tuple
getDiffTokens(self, config)
Returns valid diff tokens and tests
source code
svnmailer.differ.*
getDiffer(self, command=None)
Returns the initialized differ
source code
str
getEncodingFromMimeType(self, path, revision)
Returns the encoding extracted from svn:mime-type
source code
str
getLog(self)
Returns the log entry of the revision
source code
unicode
getPropertyDiffAction(self, values)
Returns the property diff action for a particular change
source code
unicode or {str}
getTempDir(self)
Returns the temporary directory
source code
svnmailer.util.TempFile
getTempFile(self)
Returns an open temporary file container object
source code
int
getTime(self)
Returns the time of the revision in seconds since epoch
source code
str
getUrl(self, config)
Returns the revision URL
source code
bool
isBinaryProperty(self, values)
Returns if the supplied property seems to be binary
source code
bool
isOneLineProperty(self, name, value)
Returns if the supplied property value takes just one line
source code
bool
isUTF8Property(self, name)
Returns if the supplied property name represents an UTF-8 property
source code
 
run(self)
Runs the notifier
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
unicode ADD = u'add'
"add" token
unicode COPY = u'copy'
"copy" token
unicode DELETE = u'delete'
"delete" token
str ENC_CONFIG = 'retrieve encoding from config'
magic value, meaning that the content encoding should be retrieved from the config
  ENC_DEFAULT = 'show default encoding'
str ENC_PROPERTY = 'svnmailer:content-charset'
The property name, where encodings could be stored
unicode MODIFY = u'modify'
"modify" token
unicode NONE = u'none'
"none" token
unicode PROPCHANGE = u'propchange'
"propchange" token
tuple _diffable_tests = ((u'add', <function addFunc at 0x174fc80>), ...
Map generate_diffs list entrys to change methods
Instance Variables [hide private]
list _groupset
The groupset to process
dict _penc_cache
The (path, rev) -> property encoding cache
svnmailer.settings.Settings _settings
The settings to use
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, settings, groupset)
(Constructor)

source code 

Initialization

Overrides: object.__init__

_getContentEncoding(self, path, revision)

source code 

Returns the encoding for the specified path and revision

Parameters:
  • path (str) - The path
  • revision (int) - The revision number
Returns: str
The encoding
Raises:
  • LookupError - The specified encoding is not implemented or no encoding was specified

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

source code 

Dump the two revisions of a particular change

(This dumps the files, not the properties)

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

getAuthor(self)

source code 

Returns the author of the revision

Returns: str
The author or None if there's no author

getContentDiffAction(self, change)

source code 

Returns the content diff action for a particular change

Parameters:
  • change (svnmailer.subversion.VersionedPathDescriptor) - The particular change to process
Returns: unicode
The diff token or None if there nothing

getContentDiffUrl(self, config, change)

source code 

Returns the content diff url for a particular change

Parameters:
  • config (svnmailer.settings.GroupSettingsContainer) - group config
  • change (svnmailer.subversion.VersionedPathDescriptor) - The particular change to process
Returns: str
The URL or None if there's no base URL configured

getContentEncodingProperty(self, path, revision)

source code 

Returns the content encoding property for a path/rev

Parameters:
  • path (str) - The path
  • revision (int) - The revision number
Returns: str
The encoding or None

getContentEncodings(self, change, default=None)

source code 

Returns the encodings of the change content (base and current rev)

Parameters:
  • change (svnmailer.subversion.VersionedPathDescriptor) - The change to process
  • default (str) - The default encoding, if nothing is specified
Returns: tuple of str
The two encodings

getDiffTokens(self, config)

source code 

Returns valid diff tokens and tests

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

getDiffer(self, command=None)

source code 

Returns the initialized differ

Parameters:
  • command (tuple or None) - The diff command to use (if any)
Returns: svnmailer.differ.*
The differ type

getEncodingFromMimeType(self, path, revision)

source code 

Returns the encoding extracted from svn:mime-type

Parameters:
  • path (str) - The path
  • revision (int) - The revision number
Returns: str
The encoding or None

getLog(self)

source code 

Returns the log entry of the revision

Returns: str
The log entry

getPropertyDiffAction(self, values)

source code 

Returns the property diff action for a particular change

Parameters:
  • values (tuple) - The two values of the property
Returns: unicode
The diff token

getTempDir(self)

source code 

Returns the temporary directory

Returns: unicode or {str}
The directory or None

getTempFile(self)

source code 

Returns an open temporary file container object

Returns: svnmailer.util.TempFile
The filename and an descriptor

getTime(self)

source code 

Returns the time of the revision in seconds since epoch

Returns: int
The time

getUrl(self, config)

source code 

Returns the revision URL

Returns: str
The URL or None

isBinaryProperty(self, values)

source code 

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 (tuple) - The value tuple
Returns: bool
binary property?

isOneLineProperty(self, name, value)

source code 

Returns if the supplied property value takes just one line

Parameters:
  • value (str) - The property value
  • name (str) - Property name
Returns: bool
one line property?

isUTF8Property(self, name)

source code 

Returns if the supplied property name represents an UTF-8 property

Parameters:
  • name (str) - The property name
Returns: bool
The decision

Class Variable Details [hide private]

_diffable_tests

Map generate_diffs list entrys to change methods
Type:
tuple
Value:
ADD, addFunc, (DELETE, delFunc), (COPY, copyFunc), (MODIFY, modFunc), \
(PROPCHANGE, propFunc), (NONE, noneFunc),