Exemplo n.º 1
0
    def update_links(self, source, target):
        # FIXME BaseTheme does not take into account 'child'
        BaseTheme.update_links(self, source, target)
        base = self.get_canonical_path()
        resources_new2old = get_context().database.resources_new2old
        base = str(base)
        old_base = resources_new2old.get(base, base)
        old_base = Path(old_base)
        new_base = Path(base)

        # banner_path
        site_root = self.get_site_root()
        available_languages = site_root.get_property("website_languages")

        for language in available_languages:
            value = self.get_property("banner_path", language=language)
            if not value:
                continue
            path = old_base.resolve2(value)
            if path == source:
                # Hit the old name
                # Build the new reference with the right path
                self.set_property("banner_path", new_base.get_pathto(target), language=language)

        get_context().database.change_resource(self)