'Produces URLs from our data source, hands them in to the consumer.'

def ProduceURLs(self, consumer):

    if (not self._path):
        return
    root_path = self._path
    root_URL = self._url
    root_file = self._default_file
    def PerFile(dirpath, name):
        "\n                        Called    once    per    file.\n                        Note    that    'name'    will    occasionally    be    None    --    for    a    directory    itself\n                        "
        url = URL()
        isdir = False
        try:
            if name:
                path = os.path.join(dirpath, name)
            else:
                path = dirpath
            isdir = os.path.isdir(path)
            time = None
            if (isdir and root_file):
                file = os.path.join(path, root_file)
                try:
                    time = os.stat(file)[stat.ST_MTIME]
                except OSError:
                    pass
            if (not time):
                time = os.stat(path)[stat.ST_MTIME]
            url.lastmod = TimestampISO8601(time)
        except OSError:
            pass
        except ValueError:
            pass
        middle = dirpath[len(root_path):]
        if (os.sep != '/'):
            middle = middle.replace(os.sep, '/')
        if middle:
            middle = (middle + '/')
        if name:
            middle = (middle + name)
            if isdir:
                middle = (middle + '/')
        url.TrySetAttribute('loc', (root_URL + encoder.WidenText(middle, None)))
        if (name and (root_file == name)):
            url.Log(prefix='IGNORED    (default    file)', level=2)
            return
        consumer(url, False)
    def PerDirectory(ignore, dirpath, namelist):
        '\n                        Called    once    per    directory    with    a    list    of    all    the    contained    files/dirs.\n                        '
        ignore = ignore
        if (not dirpath.startswith(root_path)):
            output.Warn(('Unable    to    decide    what    the    root    path    is    for    directory:    %s' % dirpath))
            return
        for name in namelist:
            PerFile(dirpath, name)
    output.Log(('Walking    DIRECTORY    "%s"' % self._path), 1)
    PerFile(self._path, None)
    os.path.walk(self._path, PerDirectory, None)
