Re: [Zope3-dev] Re: SVN: Zope3/branches/jim-adapter/src/zope/ Redeprecated a number of things that didn't generate warnings

2006-03-15 Thread Jim Fulton

Philipp von Weitershausen wrote:

Stephan Richter wrote:


On Tuesday 14 March 2006 17:26, Philipp von Weitershausen wrote:


The import doesn't, but the use of each method did because they looked
like this:

def getView(object, name, request, providing=Interface, context=None):
   if __warn__:
   warnings.warn(
   The concrete concept of a view has been deprecated. You 
   want to 
   use `getMultiAdapter((object, request), providing, name, 
   context)`.,
   DeprecationWarning, warningLevel())
   ...

I know for a fact that each call to getView, getResource, etc. (in
short, every function that's now in back35.py) generated warnings upon
being called, and it's the message shown above in the code snippet.


This would also be the reason you would see many less deprecation warnings.
Because here they would be only report the warning once for all getView
calls, while the import approach reports every call.



It's the other way around, but essentially yes.

Fact is, the stuff in back35.py was definitely officially deprecated since Zope
3.1. I *think* we can get rid of it.


You are right.  They are now gone.

Jim

--
Jim Fulton   mailto:[EMAIL PROTECTED]   Python Powered!
CTO  (540) 361-1714http://www.python.org
Zope Corporation http://www.zope.com   http://www.zope.org
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] Re: SVN: Zope3/branches/jim-adapter/src/zope/ Redeprecated a number of things that didn't generate warnings

2006-03-14 Thread Jim Fulton

Philipp von Weitershausen wrote:

Jim Fulton wrote:


Log message for revision 65931:
 Redeprecated a number of things that didn't generate warnings
 before. Sigh. Also fixed all the depecation warnings generated by
 running the zope.component tests.
 



...



Added: Zope3/branches/jim-adapter/src/zope/component/back35.py



I'm certain that the stuff in this file was already deprecated (and
generated deprecation warnings), so I think we can definitely get rid of
it and don't need to keep it around.


I didn't see evidence of deprecation warnings.  These methods didn't
generate warnings.  The code:

  from bbb import *

or

  from bbb import x, y, ...,

is, sadly, quite common and generates no warnings.  The fact that
deprecating these now with warnings generates tens or hundreds of
new deprecation warnings supports my case.

It's actually even worse though.  Many things that are deprecated also
provide implementation that non-deprecated code relies on. :(
I have some pending work now in which I have to sort this sort of thing
out.

This is going to take quite a bit of work to sort out.

If someone else wants to try and sort this out, I'm willing to
suspend work on my adapter branch until it's done.

I'll note that have have only about a month and a half until
the May 1 feature freeze.

Jim

--
Jim Fulton   mailto:[EMAIL PROTECTED]   Python Powered!
CTO  (540) 361-1714http://www.python.org
Zope Corporation http://www.zope.com   http://www.zope.org
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Re: SVN: Zope3/branches/jim-adapter/src/zope/ Redeprecated a number of things that didn't generate warnings

2006-03-14 Thread Jim Fulton

Stephan Richter wrote:

On Tuesday 14 March 2006 10:26, Jim Fulton wrote:


This is going to take quite a bit of work to sort out.

If someone else wants to try and sort this out, I'm willing to
suspend work on my adapter branch until it's done.



I guess it would be better to work on your branch, since you get the warnings 
there?


And because I'm farther along and because I think I have a better way to
handler these things. (See zope.deferredimport on the branch.)
Perhaps I should go ahead and merge zope.deferredimport.

 I'll have a look over the weekend.

I'm gonna need a stronger commitment than that.  This needs to be done
either before or as I do my adapter work.  I don't want to do a bunch of
work that is going to conflict with someone else.  Unfortunately, time
is in short supply.  I have to squeeze in time in the morning or on
weekends. I can't wait too long.  If you think you are going to attack
this in earnest, then I'll refocus on packaging and set the adapter work
aside for a few weeks.

I'm quite sure that a lot of things we wanted to deprecate before
(and remove now) are not generating warnings and need to be redeprecated.

Jim

--
Jim Fulton   mailto:[EMAIL PROTECTED]   Python Powered!
CTO  (540) 361-1714http://www.python.org
Zope Corporation http://www.zope.com   http://www.zope.org
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] Re: SVN: Zope3/branches/jim-adapter/src/zope/ Redeprecated a number of things that didn't generate warnings

2006-03-14 Thread Philipp von Weitershausen
Jim Fulton wrote:
 I didn't see evidence of deprecation warnings.  These methods didn't
 generate warnings.  The code:
 
   from bbb import *
 
 or
 
   from bbb import x, y, ...,
 
 is, sadly, quite common and generates no warnings.

The import doesn't, but the use of each method did because they looked
like this:

def getView(object, name, request, providing=Interface, context=None):
if __warn__:
warnings.warn(
The concrete concept of a view has been deprecated. You 
want to 
use `getMultiAdapter((object, request), providing, name, 
context)`.,
DeprecationWarning, warningLevel())
...

I know for a fact that each call to getView, getResource, etc. (in
short, every function that's now in back35.py) generated warnings upon
being called, and it's the message shown above in the code snippet.

 It's actually even worse though.  Many things that are deprecated also
 provide implementation that non-deprecated code relies on. :(

I don't think any code relies on the stuff in back35.py, except for
perhaps the get[Global]Service[s] stuff.

Philipp
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Re: SVN: Zope3/branches/jim-adapter/src/zope/ Redeprecated a number of things that didn't generate warnings

2006-03-14 Thread Stephan Richter
On Tuesday 14 March 2006 17:26, Philipp von Weitershausen wrote:
 The import doesn't, but the use of each method did because they looked
 like this:

 def getView(object, name, request, providing=Interface, context=None):
     if __warn__:
         warnings.warn(
             The concrete concept of a view has been deprecated. You 
             want to 
             use `getMultiAdapter((object, request), providing, name, 
             context)`.,
             DeprecationWarning, warningLevel())
     ...

 I know for a fact that each call to getView, getResource, etc. (in
 short, every function that's now in back35.py) generated warnings upon
 being called, and it's the message shown above in the code snippet.

This would also be the reason you would see many less deprecation warnings. 
Because here they would be only report the warning once for all getView 
calls, while the import approach reports every call.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Re: SVN: Zope3/branches/jim-adapter/src/zope/ Redeprecated a number of things that didn't generate warnings

2006-03-14 Thread Philipp von Weitershausen
Stephan Richter wrote:
 On Tuesday 14 March 2006 17:26, Philipp von Weitershausen wrote:
  The import doesn't, but the use of each method did because they looked
  like this:
 
  def getView(object, name, request, providing=Interface, context=None):
  if __warn__:
  warnings.warn(
  The concrete concept of a view has been deprecated. You 
  want to 
  use `getMultiAdapter((object, request), providing, name, 
  context)`.,
  DeprecationWarning, warningLevel())
  ...
 
  I know for a fact that each call to getView, getResource, etc. (in
  short, every function that's now in back35.py) generated warnings upon
  being called, and it's the message shown above in the code snippet.

 This would also be the reason you would see many less deprecation warnings.
 Because here they would be only report the warning once for all getView
 calls, while the import approach reports every call.

It's the other way around, but essentially yes.

Fact is, the stuff in back35.py was definitely officially deprecated since Zope
3.1. I *think* we can get rid of it.

Philipp



This message was sent using IMP, the Internet Messaging Program.
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] Re: SVN: Zope3/branches/jim-adapter/src/zope/ Redeprecated a number of things that didn't generate warnings

2006-03-13 Thread Philipp von Weitershausen
Jim Fulton wrote:
 Log message for revision 65931:
   Redeprecated a number of things that didn't generate warnings
   before. Sigh. Also fixed all the depecation warnings generated by
   running the zope.component tests.
   

...

 Added: Zope3/branches/jim-adapter/src/zope/component/back35.py

I'm certain that the stuff in this file was already deprecated (and
generated deprecation warnings), so I think we can definitely get rid of
it and don't need to keep it around.

...

 ===
 --- Zope3/branches/jim-adapter/src/zope/component/back35.py   2006-03-12 
 21:46:52 UTC (rev 65930)
 +++ Zope3/branches/jim-adapter/src/zope/component/back35.py   2006-03-12 
 21:46:54 UTC (rev 65931)
 @@ -0,0 +1,133 @@
 +##
 +#
 +# Copyright (c) 2006 Zope Corporation and Contributors.
 +# All Rights Reserved.
 +#
 +# This software is subject to the provisions of the Zope Public License,
 +# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
 +# THIS SOFTWARE IS PROVIDED AS IS AND ANY AND ALL EXPRESS OR IMPLIED
 +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 +# FOR A PARTICULAR PURPOSE.
 +#
 +##
 +Features that will be deprecated in Zope 3.5
 +
 +$Id$
 +
 +import sys
 +import warnings
 +
 +from zope.interface import Interface, providedBy
 +from zope.component.bbb.interfaces import IServiceService, IDefaultViewName
 +from zope.component.service import GlobalServiceManager
 +
 +# Try to be hookable. Do so in a try/except to avoid a hard dependency.
 +from zope.hookable import hookable
 +
 +def getGlobalServices():
 +from zope.component import getGlobalSiteManager
 +return GlobalServiceManager('servicemanager', 'zope.component.service',
 +getGlobalSiteManager())
 +
 +def getGlobalService(name):
 +return getGlobalServices().getService(name)
 +
 +def getServices(context=None):
 +if context is None:
 +return getGlobalServices()
 +else:
 +# Use the global service manager to adapt context to IServiceService
 +# to avoid the recursion implied by using a local getAdapter call.
 +try:
 +return IServiceService(context)
 +except TypeError, error:
 +from zope.component.bbb.exceptions import ComponentLookupError
 +raise ComponentLookupError(*error.args)
 +
 +getServices = hookable(getServices)
 +
 +def getService(name, context=None):
 +return getServices(context).getService(name)
 +
 +def getServiceDefinitions(context=None):
 +return getServices(context).getServiceDefinitions()
 +
 +# Presentation API
 +
 +def getView(object, name, request, providing=Interface, context=None):
 +view = queryView(object, name, request, context=context,
 + providing=providing)
 +if view is not None:
 +return view
 +
 +from zope.component.bbb.exceptions import ComponentLookupError
 +raise ComponentLookupError(Couldn't find view,
 +   name, object, context, request, providing)
 +
 +def queryView(object, name, request,
 +  default=None, providing=Interface, context=None):
 +from zope.component import queryMultiAdapter
 +return queryMultiAdapter((object, request), providing, name,
 + default, context)
 +
 +queryView = hookable(queryView)
 +
 +def getMultiView(objects, request, providing=Interface, name='', 
 context=None):
 +view = queryMultiView(objects, request, providing, name, context=context)
 +if view is not None:
 +return view
 +
 +from zope.component.bbb.exceptions import ComponentLookupError
 +raise ComponentLookupError(Couldn't find view,
 +   name, objects, context, request)
 +
 +def queryMultiView(objects, request, providing=Interface, name='',
 +   default=None, context=None):
 +from zope.component import queryMultiAdapter
 +return queryMultiAdapter(objects+(request,), providing, name,
 + default, context)
 +
 +def getViewProviding(object, providing, request, context=None):
 +return getView(object, '', request, providing, context)
 +
 +def queryViewProviding(object, providing, request, default=None, 
 +   context=None):
 +return queryView(object, '', request, default, providing, context)
 +
 +def getDefaultViewName(object, request, context=None):
 +view = queryDefaultViewName(object, request, context=context)
 +if view is not None:
 +return view
 +
 +from zope.component.bbb.exceptions import ComponentLookupError
 +raise ComponentLookupError(Couldn't find default view name,
 +   context,