Back to index

plone3  3.1.7
Classes | Functions | Variables
PlacelessTranslationService.utils Namespace Reference

Classes

class  Registry

Functions

def log
def make_relative_location

Variables

tuple logger = logging.getLogger('PlacelessTranslationService')

Function Documentation

def PlacelessTranslationService.utils.log (   msg,
  severity = logging.DEBUG,
  detail = '',
  error = None 
)

Definition at line 12 of file utils.py.

00012 
00013 def log(msg, severity=logging.DEBUG, detail='', error=None):
00014     if isinstance(msg, unicode):
00015         msg = msg.encode(sys.getdefaultencoding(), 'replace')
00016     if isinstance(detail, unicode):
00017         detail = detail.encode(sys.getdefaultencoding(), 'replace')
00018     logger.log(severity, '%s \n%s', msg, detail)

Definition at line 19 of file utils.py.

00019 
00020 def make_relative_location(popath):
00021     # return ("INSTANCE_HOME", stripped po path)
00022     # when po is located below INSTANCE_HOME
00023     # and return ("ZOPE_HOME", stripped po path) 
00024     # when po is located below ZOPE_HOME
00025 
00026     popath = os.path.normpath(popath)
00027     instance_home = os.path.normpath(INSTANCE_HOME) + os.sep
00028     client_home = os.path.normpath(CLIENT_HOME) + os.sep
00029     zope_home = os.path.normpath(ZOPE_HOME) + os.sep
00030 
00031     if popath.startswith(client_home):
00032         return ("CLIENT_HOME", popath[len(client_home):])
00033     elif popath.startswith(instance_home):
00034         return ("INSTANCE_HOME", popath[len(instance_home):])
00035     elif popath.startswith(zope_home):
00036         return ("ZOPE_HOME", popath[len(zope_home):])
00037     else:
00038         return ("ABSOLUTE", popath)
00039 

Variable Documentation

tuple PlacelessTranslationService.utils.logger = logging.getLogger('PlacelessTranslationService')

Definition at line 5 of file utils.py.