Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typo in XML exporter serialize_field in Scrapy docs #4907

Closed
Crank1d opened this issue Nov 27, 2020 · 2 comments
Closed

Typo in XML exporter serialize_field in Scrapy docs #4907

Crank1d opened this issue Nov 27, 2020 · 2 comments

Comments

@Crank1d
Copy link

Crank1d commented Nov 27, 2020

Im using code from Scrapy documentation - https://docs.scrapy.org/en/latest/topics/exporters.html, with "Product" class item created

from scrapy.exporter import XmlItemExporter

class ProductXmlExporter(XmlItemExporter):

    def serialize_field(self, field, name, value):
        if field == 'price':
            return f'$ {str(value)}'
        return super(Product, self).serialize_field(field, name, value)

and always get error from command line

return super(Product, self).serialize_field(field, name, value)
TypeError: super(Product, obj): obj must be an instance or subtype of type

Im relatively new to Python, but AFAIK, super function cannot accept Product class, it should be ProductXmlExporter, but when I change it, nothing happens to "price" field in XML export file.

@joesinghh
Copy link

I would like to work on this issue , can i get assigned ?
@wRAR

@wRAR
Copy link
Member

wRAR commented Nov 29, 2020

@Joe-Sin7h you don't need to "get assigned" to do work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants