Skip to content

Instantly share code, notes, and snippets.

@dmugtasimov
Created December 18, 2016 12:09
Show Gist options
  • Save dmugtasimov/034eb464905d479b250ad75c442ca24f to your computer and use it in GitHub Desktop.
Save dmugtasimov/034eb464905d479b250ad75c442ca24f to your computer and use it in GitHub Desktop.
Solution to exclude base class from registry
try:
Spider
except NameError:
# Spider name is not known yet so we are either
# initializing Spider class or we are initializing
# some class that is not inherited from Spider
# This mean that we do not need to add this class
# to registry
pass
else:
spider_registry.add_spider_class(cls)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment