Re: [Zope3-Users] Re: Splitting ZODB ?

2006-06-27 Thread Chris Withers

Philipp von Weitershausen wrote:

class IKeyReference(zope.interface.Interface):
A reference to an object (similar to a weak reference).

The references are compared by their hashes.


There, that wasn't so hard...


Well yeah, but it's also not very explanatory ;-)

If it's similar to a weak reference, why not just a weak reference? What 
are the salient differences between a normal weak reference and a key 
reference?


cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Splitting ZODB ?

2006-06-27 Thread Philipp von Weitershausen
Chris Withers wrote:
 Philipp von Weitershausen wrote:
 class IKeyReference(zope.interface.Interface):
 A reference to an object (similar to a weak reference).

 The references are compared by their hashes.
 

 There, that wasn't so hard...
 
 Well yeah, but it's also not very explanatory ;-)
 
 If it's similar to a weak reference, why not just a weak reference? What
 are the salient differences between a normal weak reference and a key
 reference?

Basically, key references are things you can use as keys in dicts (hence
the name). In other words, IKeyReferences provide a (unique) hash for an
object.

hash(IKeyReference(obj)) is just a fancy way of saying hash(obj).
We need the fanciness because hash(obj) is meaningless for e.g.
persistent objects or objects dynamically created from, say, a
relational database. The IKeyReference adapter can be smarter about it
and figure out what a good unique hash for the object is. E.g. the
adapter for persistent objects hashes the database name and the object's
oid. This cominbation is always unique on a system.

Feel free adding this as a README.txt to zope.app.keyreference :)

Philipp
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Getting started with testbrowser

2006-06-27 Thread Darryl Cousins
Hi All,

I'm having trouble getting started with testbrowser.

The problem is that zopeinstance/etc/ftesting.zcml is not being read.
Could someone help me get started here please?

The doc test - 
zopeinstance/lib/python/mypkg/browser/README.txt:

 from zope.testbrowser import Browser
 browser = Browser()
 browser.addHeader('Authorization', 'Basic mgr:mgrpw')
 browser = Browser('http://localhost/contents.html')

The testrunner - 
zopeinstance/lib/python/mypkg/browser/ftests.py:

def test_suite():
return unittest.TestSuite((
FunctionalDocFileSuite(
README.txt,
optionflags=doctest.ELLIPSIS |
doctest.NORMALIZE_WHITESPACE),
))

And from zopeinstance/ I run the test:
./bin/test -vv -s mypkg/browser

I get HTTPError: HTTP Error 401: Unauthorized

Which suggests that zopeinstance/etc/ftesting.zcml is not being parsed
(I tested that by putting bad data in ftesting.zcml which produced no
error).

Best regards,
Darryl Cousins

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Getting started with testbrowser

2006-06-27 Thread Baiju M

On 6/28/06, Darryl Cousins [EMAIL PROTECTED] wrote:

Hi All,

I'm having trouble getting started with testbrowser.

The problem is that zopeinstance/etc/ftesting.zcml is not being read.
Could someone help me get started here please?

The doc test -
zopeinstance/lib/python/mypkg/browser/README.txt:

 from zope.testbrowser import Browser
 browser = Browser()
 browser.addHeader('Authorization', 'Basic mgr:mgrpw')
 browser = Browser('http://localhost/contents.html')


See in the second line you created 'browser' object and set 'Authorization'
now you should open a URL like
browser.open('http://localhost/contents.html')

Here, in fourth line you again created another 'browser' object
without 'Authorization'

Regards,
Baiju M
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Getting started with testbrowser

2006-06-27 Thread Tom Dossis
Darryl Cousins wrote:

  from zope.testbrowser import Browser
  browser = Browser()
  browser.addHeader('Authorization', 'Basic mgr:mgrpw')

oops:
  browser = Browser('http://localhost/contents.html')
   # should be
   browser.open('http://localhost/contents.html')


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users