You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Within the last ~45 days, I've experienced an odd scoping / import issue with the rss_ogg plugin (disclaimer, I am the author of that plugin), how it imports/uses _encolsure from nikola.nikola vs the locally defined version of the same method, and how to correct the issue in the plugin.
The plugin has fairly standard nikola imports
from nikola import utils
from nikola.nikola import _enclosure
from nikola.plugin_categories import
and, later, defines its own version of _enclosure as such (which, I admit, is likely at least part of this error).
def_enclosure(self, post, lang):
"""Add an enclosure to RSS."""enclosure=post.meta('ogg_enclosure', lang)
ifenclosure:
try:
length=int(post.meta('ogg_enclosure_length', lang) or0)
exceptKeyError:
length=0exceptValueError:
utils.LOGGER.warn("Invalid enclosure length for post {0}".format(post.source_path))
length=0url=enclosuremime=mimetypes.guess_type(url)[0]
returnurl, length, mime
This is using nikola.nikola._enclosure rather than self.enclosure to render the xml file (I've verified this because it uses the enclosure/media info defined for a non-ogg xml file). As a short term fix/test, I've removed the import of nikola.nikola._enclosure and updated the task to call self._enclosure, but it seems like at least one of those is redundant.
Is there some kind of new scoping change/issue? Does anyone have advice on how to correct this in a clean/coherent way that is going to be better long term?
The text was updated successfully, but these errors were encountered:
Environment
Python Version: 3.9.0
Nikola Version: Nikola v8.2.2
Operating System: Windows 10 / Fedora 35
Description:
Within the last ~45 days, I've experienced an odd scoping / import issue with the rss_ogg plugin (disclaimer, I am the author of that plugin), how it imports/uses
_encolsure
fromnikola.nikola
vs the locally defined version of the same method, and how to correct the issue in the plugin.The plugin has fairly standard
nikola
importsand, later, defines its own version of
_enclosure
as such (which, I admit, is likely at least part of this error).further on, it defines its
task
like thisThis is using
nikola.nikola._enclosure
rather thanself.enclosure
to render the xml file (I've verified this because it uses the enclosure/media info defined for a non-ogg xml file). As a short term fix/test, I've removed the import ofnikola.nikola._enclosure
and updated the task to callself._enclosure
, but it seems like at least one of those is redundant.Is there some kind of new scoping change/issue? Does anyone have advice on how to correct this in a clean/coherent way that is going to be better long term?
The text was updated successfully, but these errors were encountered: