本文整理汇总了Python中zope.deprecation.deprecation.deprecated函数的典型用法代码示例。如果您正苦于以下问题:Python deprecated函数的具体用法?Python deprecated怎么用?Python deprecated使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了deprecated函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: wrap_method
def wrap_method(klass, name, method,
pattern=PATTERN, add=False, roles=None, deprecated=False):
"""takes a method and set it to a class. Annotates with hints what happened.
"""
new_name = pattern % name
if not add:
old_method = getattr(klass, name)
if isWrapperMethod(old_method):
logger.warn(
'PlonePAS: *NOT* wrapping already wrapped method at '
'{0}.{1}'.format(
klass.__name__, name)
)
return
logger.debug(
'PlonePAS: Wrapping method at %s.%s',
klass.__name__, name
)
setattr(klass, new_name, old_method)
setattr(method, ORIG_NAME, new_name)
setattr(method, WRAPPER, True)
setattr(method, ADDED, False)
else:
logger.debug('PlonePAS: Adding method at %s.%s', klass.__name__, name)
setattr(method, WRAPPER, False)
setattr(method, ADDED, True)
if deprecated:
setattr(klass, name, deprecation.deprecated(method, deprecated))
else:
setattr(klass, name, method)
if roles is not None:
roles_attr = '{0}__roles__'.format(name)
logger.debug(
'PlonePAS: Setting new permission roles at {0}.{1}'.format(
klass.__name__, name
)
)
setattr(klass, roles_attr, roles)
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:41,代码来源:patch.py
示例2: setUpFunctional
"kotti.populators": "kotti.populate.populate_users",
"pyramid.includes": "kotti.testing.include_testing_view",
"kotti.root_factory": "kotti.testing.RootFactory",
"kotti.site_title": "My Stripped Down Kotti",
}
_settings.update(settings)
return setUpFunctional(global_config, **_settings)
# noinspection PyPep8Naming
def registerDummyMailer():
from pyramid_mailer.mailer import DummyMailer
from kotti.message import _inject_mailer
mailer = DummyMailer()
_inject_mailer.append(mailer)
return mailer
# set up deprecation warnings
from zope.deprecation.deprecation import deprecated # noqa
for item in UnitTestBase, EventTestBase, FunctionalTestBase, _init_testing_db:
name = getattr(item, "__name__", item)
deprecated(
name,
"Unittest-style tests are deprecated as of Kotti 0.7. "
"Please use pytest function arguments instead.",
)
开发者ID:Kotti,项目名称:Kotti,代码行数:30,代码来源:testing.py
示例3: ObjectUpdate
class ObjectUpdate(ObjectEvent):
"""This event is emitted when an object in the DB is updated."""
class ObjectDelete(ObjectEvent):
"""This event is emitted when an object is deleted from the DB."""
class ObjectAfterDelete(ObjectEvent):
"""This event is emitted after an object has been deleted from the DB.
.. deprecated:: 0.9
"""
deprecated('ObjectAfterDelete',
"The ObjectAfterDelete event is deprecated and will be no longer "
"available starting with Kotti 0.10.")
class UserDeleted(ObjectEvent):
"""This event is emitted when an user object is deleted from the DB."""
class DispatcherDict(defaultdict, OrderedDict):
"""Base class for dispatchers"""
def __init__(self, *args, **kwargs):
defaultdict.__init__(self, list)
OrderedDict.__init__(self, *args, **kwargs)
开发者ID:adamcheasley,项目名称:Kotti,代码行数:28,代码来源:events.py
示例4: _callFUT
def _callFUT(self, spec, message, *args):
from zope.deprecation.deprecation import deprecated
return deprecated(spec, message, *args)
开发者ID:marcosptf,项目名称:fedora,代码行数:3,代码来源:tests.py
示例5: MetaData
from kotti.sqla import Base as KottiBase
metadata = MetaData()
DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
Base = declarative_base(cls=KottiBase)
Base.metadata = metadata
Base.query = DBSession.query_property()
TRUE_VALUES = ('1', 'y', 'yes', 't', 'true')
FALSE_VALUES = ('0', 'n', 'no', 'f', 'false', 'none')
# BBB module deprecation
from kotti import fanstatic
sys.modules['kotti.static'] = deprecation.deprecated(
fanstatic,
"The module kotti.static has been moved to kotti.fanstatic as of Kotti "
"0.8. Import from there instead.")
def authtkt_factory(**settings):
from kotti.security import list_groups_callback
kwargs = dict(
secret=settings['kotti.secret2'],
hashalg='sha512',
callback=list_groups_callback,
)
try:
return AuthTktAuthenticationPolicy(**kwargs)
except TypeError:
# BBB with Pyramid < 1.4
kwargs.pop('hashalg')
开发者ID:Happystation,项目名称:Kotti,代码行数:32,代码来源:__init__.py
示例6: deprecated
:param context: context that should be checked for the given permission
:type context: :class:``kotti.resources.Node``
:param request: current request
:type request: :class:`kotti.request.Request`
:result: ``True`` if request has the permission, ``False`` else
:rtype: bool
"""
return request.has_permission(permission, context)
deprecated(u'has_permission',
u"kotti.security.has_permission is deprecated as of Kotti 1.0 and "
u"will be no longer available starting with Kotti 2.0. "
u"Please use the has_permission method of request instead.")
class Principal(Base):
"""A minimal 'Principal' implementation.
The attributes on this object correspond to what one ought to
implement to get full support by the system. You're free to add
additional attributes.
- As convenience, when passing 'password' in the initializer, it
is hashed using 'get_principals().hash_password'
- The boolean 'active' attribute defines whether a principal may
log in. This allows the deactivation of accounts without
开发者ID:WenkeZhou,项目名称:Kotti,代码行数:31,代码来源:security.py
示例7: attachment_view
@view_config(name='attachment-view', context=IFile, permission='view')
def attachment_view(context, request):
return request.uploaded_file_response(context.data, 'attachment')
def includeme(config):
config.scan(__name__)
# DEPRECATED
from zope.deprecation.deprecation import deprecated
from kotti.filedepot import StoredFileResponse
class UploadedFileResponse(StoredFileResponse):
def __init__(self, data, request, disposition='attachment',
cache_max_age=None, content_type=None,
content_encoding=None):
super(UploadedFileResponse, self).__init__(
data.file, request, disposition=disposition,
cache_max_age=cache_max_age, content_type=content_type,
content_encoding=content_encoding)
deprecated('UploadedFileResponse',
'UploadedFileResponse is deprecated and will be removed in '
'Kotti 2.0.0. Use "request.uploaded_file_response(context.data)" '
'instead.')
开发者ID:IonicaBizauKitchen,项目名称:Kotti,代码行数:28,代码来源:file.py
示例8: str
("Content-Type", str(context.mimetype)),
]
)
res.body = context.data
return res
@view_config(name="attachment-view", context=File, permission="view")
def attachment_view(context, request):
return inline_view(context, request, "attachment")
def includeme(config):
config.scan(__name__)
# BBB
from .edit.content import FileAddForm as AddFileFormView
from .edit.content import ImageAddForm as AddImageFormView
from .edit.content import FileEditForm as EditFileFormView
from .edit.content import ImageEditForm as EditImageFormView
for cls in (AddFileFormView, AddImageFormView, EditFileFormView, EditImageFormView):
deprecated(
cls,
"""\
%s has been renamed (e.g. 'FileAddForm' became 'AddFileFormView') and moved to
kottiv.views.edit.content as of Kotti 0.8."""
% cls.__name__,
)
开发者ID:navi7,项目名称:Kotti,代码行数:30,代码来源:file.py
示例9: get_current_registry
# Allow users of Kotti to cherry pick the tables that they want to use:
settings = get_current_registry().settings
tables = settings['kotti.use_tables'].strip() or None
if tables:
tables = [metadata.tables[name] for name in tables.split()]
if engine.dialect.name == 'mysql': # pragma: no cover
from sqlalchemy.dialects.mysql.base import LONGBLOB
File.__table__.c.data.type = LONGBLOB()
# Allow migrations to set the 'head' stamp in case the database is
# initialized freshly:
if not engine.table_names():
stamp_heads()
metadata.create_all(engine, tables=tables)
if os.environ.get('KOTTI_DISABLE_POPULATORS', '0') not in ('1', 'y'):
for populate in get_settings()['kotti.populators']:
populate()
commit()
return DBSession
# BBB
for iface in ("INode", "IContent", "IDocument", "IFile", "IImage",
"IDefaultWorkflow"):
deprecated(iface,
"%s has been moved to kotti.interfaces as of Kotti 0.8. "
"Import from there instead." % iface)
开发者ID:j23d,项目名称:Kotti,代码行数:30,代码来源:resources.py
示例10: submit
projectId=project_id,
region=region,
clusterName=cluster_name
).execute(num_retries=self.num_retries)
def submit(self, project_id, job, region='global', job_error_states=None):
submitted = _DataProcJob(self.get_conn(), project_id, job, region,
job_error_states=job_error_states,
num_retries=self.num_retries)
if not submitted.wait_for_done():
submitted.raise_error()
def create_job_template(self, task_id, cluster_name, job_type, properties):
return _DataProcJobBuilder(self.project_id, task_id, cluster_name,
job_type, properties)
def wait(self, operation):
"""Awaits for Google Cloud Dataproc Operation to complete."""
submitted = _DataProcOperation(self.get_conn(), operation,
self.num_retries)
submitted.wait_for_done()
setattr(
DataProcHook,
"await",
deprecation.deprecated(
DataProcHook.wait, "renamed to 'wait' for Python3.7 compatibility"
),
)
开发者ID:apache,项目名称:incubator-airflow,代码行数:30,代码来源:gcp_dataproc_hook.py
示例11: setUpFunctional
'kotti.populators': 'kotti.populate.populate_users',
'pyramid.includes': 'kotti.testing.include_testing_view',
'kotti.root_factory': 'kotti.testing.RootFactory',
'kotti.site_title': 'My Stripped Down Kotti',
}
_settings.update(settings)
return setUpFunctional(global_config, **_settings)
def registerDummyMailer():
from pyramid_mailer.mailer import DummyMailer
from kotti.message import _inject_mailer
mailer = DummyMailer()
_inject_mailer.append(mailer)
return mailer
# set up deprecation warnings
from zope.deprecation.deprecation import deprecated # noqa
for item in UnitTestBase, EventTestBase, FunctionalTestBase, _initTestingDB:
name = getattr(item, '__name__', item)
deprecated(name, 'Unittest-style tests are deprecated as of Kotti 0.7. '
'Please use pytest function arguments instead.')
TestingRootFactory = RootFactory
deprecated('TestingRootFactory',
"TestingRootFactory has been renamed to RootFactory and will be no "
"longer available starting with Kotti 2.0.0.")
开发者ID:disko,项目名称:Kotti,代码行数:30,代码来源:testing.py
示例12: _resolve_dotted
# Allow users of Kotti to cherry pick the tables that they want to use:
settings = _resolve_dotted(get_settings())
tables = settings["kotti.use_tables"].strip() or None
if tables:
tables = [metadata.tables[name] for name in tables.split()]
_adjust_for_engine(engine)
# Allow migrations to set the 'head' stamp in case the database is
# initialized freshly:
if not engine.table_names():
stamp_heads()
metadata.create_all(engine, tables=tables)
if os.environ.get("KOTTI_DISABLE_POPULATORS", "0") not in TRUE_VALUES:
for populate in settings["kotti.populators"]:
populate()
commit()
return DBSession
# DEPRECATED
from zope.deprecation.deprecation import deprecated
from kotti_image.resources import Image
__ = Image
deprecated("Image", "Image was outfactored to the kotti_image package. " "Please import from there.")
开发者ID:IonicaBizauKitchen,项目名称:Kotti,代码行数:29,代码来源:resources.py
示例13: _resolve_dotted
settings = _resolve_dotted(get_settings())
tables = settings['kotti.use_tables'].strip() or None
if tables:
tables = [metadata.tables[name] for name in tables.split()]
_adjust_for_engine(engine)
# Allow migrations to set the 'head' stamp in case the database is
# initialized freshly:
if not engine.table_names():
stamp_heads()
metadata.create_all(engine, tables=tables)
if os.environ.get('KOTTI_DISABLE_POPULATORS', '0') not in TRUE_VALUES:
for populate in settings['kotti.populators']:
populate()
commit()
return DBSession
# DEPRECATED
from zope.deprecation.deprecation import deprecated
from kotti_image.resources import Image
__ = Image
deprecated('Image',
'Image was outfactored to the kotti_image package. '
'Please import from there.')
开发者ID:disko,项目名称:Kotti,代码行数:30,代码来源:resources.py
示例14: dict
RESET_PASSWORD_SUBJECT = u"Reset your password for %(site_title)s."
RESET_PASSWORD_BODY = u"""Hello, %(user_title)s!
Click this link to reset your password at %(site_title)s: %(url)s.
"""
message_templates = {
'set-password': dict(
subject=SET_PASSWORD_SUBJECT, body=SET_PASSWORD_BODY),
'reset-password': dict(
subject=RESET_PASSWORD_SUBJECT, body=RESET_PASSWORD_BODY),
}
deprecated(
'message_templates',
'message_templates is deprecated as of Kotti 0.6.4. '
'Use the ``email-set-password.pt`` and ``email-reset-password.pt`` '
'templates instead.'
)
_inject_mailer = []
def get_mailer():
# Consider that we may have persistent settings
if _inject_mailer:
return _inject_mailer[0]
return Mailer.from_settings(get_settings()) # pragma: no cover
def make_token(user, seconds=None):
secret = get_settings()['kotti.secret2']
开发者ID:geojeff,项目名称:Kotti,代码行数:31,代码来源:message.py
注:本文中的zope.deprecation.deprecation.deprecated函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论