Re: [Zope-dev] Unittests with different zope configuration?

2006-06-07 Thread Stefan H. Holek

I use this to set debug-mode off:

# Switch off debug mode
import App.config
config = App.config.getConfiguration()
config.debug_mode = 0
App.config.setConfiguration(config)

Stefan


On 5. Jun 2006, at 11:50, Andreas Jung wrote:

Does anyone know how to write unittests that have to deal with  
different configurations in zope.conf? In my particular case I need  
write some tests for sequence.sort() that deal with the 'locale'  
configuration in zope.conf.

So how do I setup a different configurations in a unit test?

Andreas


--
Anything that happens, happens.  --Douglas Adams


___
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 )


[Zope-dev] Re: Unittests with different zope configuration?

2006-06-07 Thread Rocky Burt
On Wed, 2006-07-06 at 12:04 +0200, Stefan H. Holek wrote:
 I use this to set debug-mode off:
 
  # Switch off debug mode
  import App.config
  config = App.config.getConfiguration()
  config.debug_mode = 0
  App.config.setConfiguration(config)

Oh wow, this trick should come in handy.  Thanks Stefan!

- Rocky

-- 
Rocky Burt
ServerZen Software -- http://www.serverzen.com
News About The Server (blog) -- http://www.serverzen.net



signature.asc
Description: This is a digitally signed message part
___
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: [Zope-dev] Re: Unittests with different zope configuration?

2006-06-07 Thread Andreas Jung



--On 7. Juni 2006 08:50:41 -0230 Rocky Burt [EMAIL PROTECTED] wrote:


On Wed, 2006-07-06 at 12:04 +0200, Stefan H. Holek wrote:

I use this to set debug-mode off:

 # Switch off debug mode
 import App.config
 config = App.config.getConfiguration()
 config.debug_mode = 0
 App.config.setConfiguration(config)


Oh wow, this trick should come in handy.  Thanks Stefan!



Cheers to Mr. Testing

Andreas

pgp6NtMNQBjHI.pgp
Description: PGP signature
___
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 )


[Zope-dev] Re: Unittests with different zope configuration?

2006-06-07 Thread Florent Guillaume

Stefan H. Holek wrote:

I use this to set debug-mode off:

# Switch off debug mode
import App.config
config = App.config.getConfiguration()
config.debug_mode = 0
App.config.setConfiguration(config)


The setConfiguration() is probably unnecessary, you're modifying a mutable 
datastructure.


Florent

--
Florent Guillaume, Nuxeo (Paris, France)   Director of RD
+33 1 40 33 71 59   http://nuxeo.com   [EMAIL PROTECTED]
___
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: [Zope-dev] Re: Unittests with different zope configuration?

2006-06-07 Thread Andreas Jung



--On 7. Juni 2006 14:28:03 +0200 Florent Guillaume [EMAIL PROTECTED] wrote:


Stefan H. Holek wrote:

I use this to set debug-mode off:

# Switch off debug mode
import App.config
config = App.config.getConfiguration()
config.debug_mode = 0
App.config.setConfiguration(config)


The setConfiguration() is probably unnecessary, you're modifying a
mutable datastructure.


Probably unnecessary but one should not depend on an implementation
detail in this case.

-aj

pgpTts7ZTWOGr.pgp
Description: PGP signature
___
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 )


[Zope-dev] Re: Unittests with different zope configuration?

2006-06-07 Thread Florent Guillaume

Zope core doesn't use the legacy locations anymore however, right?
It would potentially impact only third-party products?

Florent

On 7 Jun 2006, at 14:47, Stefan H. Holek wrote:

It is needed to update legacy locations, e.g. copying  
config.instancehome to the INSTANCE_HOME built-in and into the  
environment. The debug_mode flag has a legacy location of  
Globals.DevelopmentMode.


Cheers,
Stefan

On 7. Jun 2006, at 14:28, Florent Guillaume wrote:


Stefan H. Holek wrote:

I use this to set debug-mode off:
# Switch off debug mode
import App.config
config = App.config.getConfiguration()
config.debug_mode = 0
App.config.setConfiguration(config)


The setConfiguration() is probably unnecessary, you're modifying a  
mutable datastructure.


Florent


--
Anything that happens, happens.  --Douglas Adams




--
Florent Guillaume, Nuxeo (Paris, France)   Director of RD
+33 1 40 33 71 59   http://nuxeo.com   [EMAIL PROTECTED]


___
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: [Zope-dev] Re: zope2 requests VS zope3 requests

2006-06-07 Thread Philipp von Weitershausen
Stefan H. Holek wrote:
 -1
 
 The whole point of sticking with Zope2 is backward compatibility, isn't
 it? If I wanted something that doesn't run my old products and
 applications anymore I would go to Zope3 directly, why thank you.

Hey, the idea isn't to run Zope 3 directly but to evolve, remember? How
can we evolve if we don't ever change anything? Of course we'll provide
BBB for the usual amount of time.

 Please keep this in mind in your spree to make Zope2 look like Zope3.
 Backward compatibility is paramount.

Of course, but not forever. Eternal backward compatibility (even with
Zope 1) has lead to what Zope 2 and its various bit-rotten APIs are
today. Is it such a surprise then that Zope 3 ended up being a complete
rewrite because people realized early on that it was just way too hard
to satisfy all those weird quirks in Zope 2? Well, it turns out that we
do want to evolve Zope 2, so now we're doing all that work in cleaning
up the mess.

The amount of time I alone have spent in debugging Zope 2 because it
eats exceptions, magically acquires things or excepts this or that is
just ridiculous. But don't get me wrong, I'm not complaining. I'm just
trying to improve things.

 Next thing you are going to remove implicit acquisition ;-).

Nope :).

 On 28. Mai 2006, at 12:53, Philipp von Weitershausen wrote:
 
 That's true. However, we really want the Zope 2 request to (eventually)
 become like the Zope 3 browser request. In fact, in many places we
 already assume that the Zope 2 request is like a Zope 3 browser request.
 We stick IBrowserRequest on it and hand it over to lots of Zope 3
 machinery. So far this has worked relatively well, but there are
 problems coming up with certain API subtleties.

 I think the biggest challenge will be to deprecate __getattr__ access
 for request variables and only allow __getitem__ for this. Then, the
 getattr protocol will be used to access the request API only. For
 example, IBrowserRequest demands that requests have a 'debug' attribute.
 In Zope 2, we have the problem that request.debug is an alternate
 spelling of request.form['debug']. If that alternate spelling wasn't
 there, request.debug was free for the IBrowserRequest API. Right now
 we're doing a frame hack to see where the caller is coming from and
 either yield request.debug or request.form['debug'].
___
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 )