[Zope-dev] coding style: using zapi recommended?

2008-04-14 Thread yuppie

Hi!


Products.Five.browser.adding is basically a copy of 
zope.app.container.browser.adding. Over time they became more out of 
sync than necessary. I'd like to fix that, but have one question:



In the Five version

  from zope.app import zapi
  factory = zapi.getUtility(IFactory, type_name)

was replaced by

  import zope.component
  factory = zope.component.getUtility(IFactory, type_name)

(http://svn.zope.org/Products.Five/trunk/browser/adding.py?rev=67820r1=67728r2=67820)

Was this a code modernization that should be ported to 
zope.app.container? Or should I revert the change in Products.Five? 
Keeping two different versions makes it unnecessarily hard to read the 
diffs.


Personally, I prefer yet an other version:

  from zope.component import getUtility
  factory = getUtility(IFactory, type_name)

But I don't want to change both files if there is no recommended version.

Maybe we don't need a strict policy for this, but some guidance would be 
nice to have.



Any opinions? Any guidelines I missed?


Cheers,

Yuppie


___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )


AW: [Zope-dev] coding style: using zapi recommended?

2008-04-14 Thread Roger Ineichen
Hi yuppie

 Betreff: [Zope-dev] coding style: using zapi recommended?

[...]

 In the Five version
 
from zope.app import zapi
factory = zapi.getUtility(IFactory, type_name)
 
 was replaced by
 
import zope.component
factory = zope.component.getUtility(IFactory, type_name)

Use zope.component and skip dependency to zope.app 
by using from zope.app import zapi.

Feel free to replace zapi everywhere in all packages
if you change something.

Regards
Roger Ienichen

___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: AW: [Zope-dev] coding style: using zapi recommended?

2008-04-14 Thread Jim Fulton


On Apr 14, 2008, at 7:29 AM, Roger Ineichen wrote:

Feel free to replace zapi everywhere in all packages
if you change something.



+1

Jim

--
Jim Fulton
Zope Corporation


___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope )