mirror of https://github.com/scrapy/scrapy.git
Some cleanup.
This commit is contained in:
parent
fdbc141b23
commit
7ebb8256f0
|
|
@ -43,7 +43,6 @@ case with one requiring no configuration) are enabled/configured in a project's
|
|||
INSTALLED_ADDONS = (
|
||||
'httpcache',
|
||||
'path.to.some.addon',
|
||||
'path/to/other/addon.py',
|
||||
)
|
||||
|
||||
HTTPCACHE = {
|
||||
|
|
@ -73,8 +72,6 @@ dictionary keys. I.e., the configuration from above would look like this:
|
|||
[addon:path.to.some.addon]
|
||||
some_config = true
|
||||
|
||||
[addon:path/to/other/addon.py]
|
||||
|
||||
|
||||
Enabling and configuring add-ons within Python code
|
||||
---------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -156,10 +156,10 @@ class AddonManager(Mapping):
|
|||
|
||||
addons = AddonManager()
|
||||
# ... load some add-ons here
|
||||
print addons.enabled # prints names of all enabled add-ons
|
||||
print addons['TestAddon'].version # prints version of add-on with name
|
||||
print(addons.enabled) # prints names of all enabled add-ons
|
||||
print(addons['TestAddon'].version) # prints version of add-on with name
|
||||
# 'TestAddon'
|
||||
print addons.configs['TestAddon'] # prints configuration of 'TestAddon'
|
||||
print(addons.configs['TestAddon']) # prints configuration of 'TestAddon'
|
||||
|
||||
"""
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
import zope.interface
|
||||
from zope.interface import moduleProvides
|
||||
|
||||
from scrapy.interfaces import IAddon
|
||||
|
||||
zope.interface.moduleProvides(IAddon)
|
||||
|
||||
FROM = "test_addons.addonmod"
|
||||
moduleProvides(IAddon)
|
||||
|
||||
name = "AddonModule"
|
||||
version = "1.0"
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
import zope.interface
|
||||
from zope.interface import implementer
|
||||
|
||||
from scrapy.interfaces import IAddon
|
||||
|
||||
|
||||
class Addon(object):
|
||||
FROM = "test_addons.addons"
|
||||
|
||||
|
||||
@zope.interface.declarations.implementer(IAddon)
|
||||
@implementer(IAddon)
|
||||
class GoodAddon(object):
|
||||
name = "GoodAddon"
|
||||
version = "1.0"
|
||||
|
|
@ -28,7 +24,7 @@ class GoodAddon(object):
|
|||
pass
|
||||
|
||||
|
||||
@zope.interface.declarations.implementer(IAddon)
|
||||
@implementer(IAddon)
|
||||
class BrokenAddon(object):
|
||||
name = "BrokenAddon"
|
||||
# No version
|
||||
|
|
|
|||
Loading…
Reference in New Issue