Ejemplo n.º 1
0
def list_cleanerml_files(local_only=False):
    """List CleanerML files"""
    cleanerdirs = (Common.local_cleaners_dir, Common.personal_cleaners_dir)
    if not local_only and Common.system_cleaners_dir:
        cleanerdirs += (Common.system_cleaners_dir, )
    for pathname in listdir(cleanerdirs):
        if not pathname.lower().endswith('.xml'):
            continue
        import stat
        st = os.stat(pathname)
        if sys.platform != 'win32' and stat.S_IMODE(st[stat.ST_MODE]) & 2:
            print "warning: ignoring cleaner '%s' because it is world writable" % pathname
            continue
        yield pathname
Ejemplo n.º 2
0
def list_cleanerml_files(local_only=False):
    """List CleanerML files"""
    cleanerdirs = (Common.local_cleaners_dir,
                   Common.personal_cleaners_dir)
    if not local_only and Common.system_cleaners_dir:
        cleanerdirs += (Common.system_cleaners_dir, )
    for pathname in listdir(cleanerdirs):
        if not pathname.lower().endswith('.xml'):
            continue
        import stat
        st = os.stat(pathname)
        if sys.platform != 'win32' and stat.S_IMODE(st[stat.ST_MODE]) & 2:
            print "warning: ignoring cleaner '%s' because it is world writable" % pathname
            continue
        yield pathname
Ejemplo n.º 3
0
def create_pot():
    """Create a .pot for translation using gettext"""

    f = open('../po/cleanerml.pot', 'w')

    for pathname in listdir('../cleaners'):
        if not pathname.lower().endswith(".xml"):
            continue
        strings = []
        try:
            CleanerML(pathname,
                      lambda newstr, translators=None:
                      strings.append([newstr, translators]))
        except:
            print "error reading '%s'" % pathname
            traceback.print_exc()
        else:
            for (string, translators) in strings:
                f.write(pot_fragment(string, pathname, translators))

    f.close()
Ejemplo n.º 4
0
def create_pot():
    """Create a .pot for translation using gettext"""

    f = open('../po/cleanerml.pot', 'w')

    for pathname in listdir('../cleaners'):
        if not pathname.lower().endswith(".xml"):
            continue
        strings = []
        try:
            CleanerML(pathname,
                      lambda newstr, translators=None:
                      strings.append([newstr, translators]))
        except:
            logger = logging.getLogger(__name__)
            logger.exception('error reading: %s' % pathname)
            continue
        for (string, translators) in strings:
            f.write(pot_fragment(string, pathname, translators))

    f.close()
Ejemplo n.º 5
0
def create_pot():
    """Create a .pot for translation using gettext"""

    f = open('../po/cleanerml.pot', 'w')

    for pathname in listdir('../cleaners'):
        if not pathname.lower().endswith(".xml"):
            continue
        strings = []
        try:
            CleanerML(pathname,
                      lambda newstr, translators=None: strings.append(
                          [newstr, translators]))
        except:
            logger = logging.getLogger(__name__)
            logger.exception('error reading: %s' % pathname)
            continue
        for (string, translators) in strings:
            f.write(pot_fragment(string, pathname, translators))

    f.close()
Ejemplo n.º 6
0
def create_pot():
    """Create a .pot for translation using gettext"""

    f = open('../po/cleanerml.pot', 'w')

    for pathname in listdir('../cleaners'):
        if not pathname.lower().endswith(".xml"):
            continue
        strings = []
        try:
            CleanerML(pathname,
                      lambda newstr, translators=None: strings.append(
                          [newstr, translators]))
        except:
            print "error reading '%s'" % pathname
            traceback.print_exc()
        else:
            for (string, translators) in strings:
                f.write(pot_fragment(string, pathname, translators))

    f.close()