File: deprecate.py

package info (click to toggle)
python-scrapy 0.14.4-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,064 kB
  • sloc: python: 19,468; xml: 199; sh: 134; makefile: 67
file content (11 lines) | stat: -rw-r--r-- 437 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
"""Some helpers for deprecation messages"""

import warnings

from scrapy.exceptions import ScrapyDeprecationWarning

def attribute(obj, oldattr, newattr, version='0.12'):
    cname = obj.__class__.__name__
    warnings.warn("%s.%s attribute is deprecated and will be no longer supported "
        "in Scrapy %s, use %s.%s attribute instead" % \
        (cname, oldattr, version, cname, newattr), ScrapyDeprecationWarning, stacklevel=3)