Re: [Zope-dev] Testing my product

2002-01-18 Thread Thomas Förster

On Thursday, 17. January 2002 16:02, Chris McDonough wrote:

  ...[unittesting products]...

 Please read both the Zope developer's guide and the document UNITTEST.txt
 in the Zope doc directory. 

Well, UNITTEST.txt is focused on writing unit tests for the Zope core itself. 
My experience is, that the instructions in that file not really apply to 
unittests for custom Products. To cut it short, it didn't work for me.

I've found another solution, using unittest.py directly, rather than copying 
framework.py  This solution is implemented in the ZOQLMethod Product by 
Stephan Richter, so you might as well have a look into that for an example.

 These pages are also helpful:
 http://dev.zope.org/CVS/ZopeTestingGuidelines ,
 http://diveintopython.org/roman_divein.html ,
 http://pyunit.sourceforge.net/pyunit.html .

Maybe http://www.extremeprogramming.org has some further introduction to unit 
tests and test first design too.

Regards,
Thomas
-- 
Webmaster
Innovationskolleg Theoretische Biologie
http://itb.biologie.hu-berlin.de

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



[Zope-dev] im_self of methods accessed via non trivial acquisition

2002-01-18 Thread Stefan Bund


I have already posted this question on the main zope list but have
not received a reply. I hope som Acquisition god is following this
list to shed some light on this matter. 

If there is some kind of definite documentation for the acquisition
machinery especially for how methods are fetched across acquisition, I
would appreciate a pointer to that Documentation. I allready tried to
digest the ZDG (chapter on Acquisition) and the information on the
'AcquisitionMadness' page
http://www.zope.org//Wikis/zope-dev/AcquisitionMadness. Is there any
more *definite* information on Acquisition apart from the source
code. The problem is, I have a bit difficulty reading the source since
it's an extension class :-(...

But now on to the details of my original question (this is a copy of
my post to the zope list):

My question regards the details of how the contents of im_self of an
acquired method is calculated by the acquisition machinery.

To illustrate this, I will depict an acquisition tree using the
following symbols:

  O-- an acquisition wrapper
  upcase letter  -- an acquitsition wrapper named for further reference
  [lowercase letter] -- an object
  --   -- the aq_parent link
  |-- the aq_self link


I will use the following acquisition tree for illustration (it
resembles the tree I have in my application, I just reduced it to
make my point)

A--O--[a]
|  |
|  [b]
|
O--B--O--[c]
|  |  |
|  |  [d]
|  |
|  O--[e]
|  |
|  [f]
|
[g]

(Note: some of the a-g's are identical, but for simpler reference from
the text, i have named them all differently ...)

In this representation, the acquisition order is from bottom to top.
The bottom most object is /A.aq_base/. Acquisition along containment
only produces horizontal lines of acquisition wrappers.

let /m/ be a method of the objekt /f/. The expression of interest is

x := A.m

I would expect /x.im_self/ to be an acquisition wrapper C

C := A.f

where (as far as i understand the rules of acquisition) 
/C.aq_parent == A/

But instead displaying  /x.im_self/ yields the acquisition tree rooted
at /B/ !!

I find this a bit disturbing. My question: 'Is it a *bug* or a
*feature*?'. I hope, I made my point clear.

I hope someone can shed light on this subject,

Stefan.

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



Re: [Zope-dev] im_self of methods accessed via non trivial acquisition

2002-01-18 Thread Phillip J. Eby

At 09:42 AM 1/18/02 +0100, Stefan Bund wrote:

A--O--[a]
|  |
|  [b]
|
O--B--O--[c]
|  |  |
|  |  [d]
|  |
|  O--[e]
|  |
|  [f]
|
[g]

...

let /m/ be a method of the objekt /f/. The expression of interest is

 x := A.m

I would expect /x.im_self/ to be an acquisition wrapper C

 C := A.f

where (as far as i understand the rules of acquisition)
/C.aq_parent == A/

But instead displaying  /x.im_self/ yields the acquisition tree rooted
at /B/ !!

I find this a bit disturbing. My question: 'Is it a *bug* or a
*feature*?'. I hope, I made my point clear.

Method rebinding is done only when an item is retrieved from the aq_self 
side, and only if im_self points to aq_self.  If these conditions are met, 
a new binding is created which points to the acquisition wrapper.

This is a feature, not a bug.  If you rebind im_self on the aq_parent side, 
and your method assigns a value to an attribute of self, it will be 
assigned to the wrong object!  It is safe in your example to bind m.im_self 
to B, because B.aq_base is f, the true self of m.  But it is not safe to 
bind m.im_self to A, because A.aq_base is g -- another object altogether.

I guess another way to look at it is that a method retrieved from an 
acquisition-wrapped object will always meet the condition that 
method.im_self.aq_base is the original object the method was retrieved 
from.  This ensures that the method simply works with an 
acquisition-wrapped version of its original self.


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



Re: [Zope-dev] Re: [Zope] Error on install

2002-01-18 Thread Matthew T. Kromer

Eron Lloyd wrote:

Chris (or anybody else), 

Have you tried to install Beta4 using the linux binary package yet? I'm 
trying to write a patch against it but the installation does in fact bomb out 
each time I try to run it, even freshly untarred. The source TGZ works fine 
and dandy, however. It seems compilezpy.py has been dramatically changed 
since Beta3, as if to try and surpress the stdout messages. I'm going to try 
and break it down and find out where the exceptions are flagging, and also 
refactor my patch so it doesn't depend on the changes being made to 
compilezpy.py. I don't like wrapping a gag around code if I don't have to, 
and I'd rather this stuff be written to an install log or something.

I-see-a-fishbowl-proposal-for-a-new-installer-ly yours,

Eron


Hi Eron,

One of the engineers snuck in a last minute change to fix the install 
process to not install if compilation of any module fails.  However, the 
test suite for Python itself has some modules that don't compile, and 
they're causing the newly fixed installer to complain.

In the file inst/compilezpy.py, you can delete the section that says 
(starting at about line 45):

if not success:


to the end of the file and rerun the install program.

This one was particularly aggravating because the beta 4 release is only 
supposed to include bugfixes, not 'features'.  Clearly, I distingush 
between a bug fix which fixes an existing problem causing Zope to not 
work vs a feature which causes an otherwise working Zope to cease 
functioning.  :)


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



[Zope-dev] Security Gurus Wanted

2002-01-18 Thread vio

Could someone have a look at the following 'Boring' class with the security 
functionality added (as described in ZopeBook/6.Security and some other products). 
Could 'security' machinery be broken in Zope-2.4.1 ? It surely doesn't seem to work as 
adverised, on my machine at least (Debian Linux 2.2, Zope 2.4.1 (source release) 
python 2.1.0, linux2). Tell me if it works on your installation.


Boring.py

__doc__ = 
__version__ = '0.1'
import Globals
from Globals import HTMLFile  # fakes a method from a DTML file
from Globals import MessageDialog # provid
from Globals import Persistent# makes an object stick in the ZODB
import OFS.SimpleItem
import Acquisition
import AccessControl.Role
from AccessControl import ClassSecurityInfo

READ_PERM = 'View Stuff'
WRITE_PERM = 'Change Stuff'
security = ClassSecurityInfo()

manage_addBoringForm = HTMLFile('boringAdd', globals())
def manage_addBoring(self, id, title='', REQUEST=None):
Add a Boring to a folder.
self._setObject(id, Boring(id, title))
if REQUEST is not None:
return self.manage_main(self, REQUEST)

class Boring(
OFS.SimpleItem.Item,   # A simple Principia object. Not Folderish.
Persistent,# Make us persistent. Yaah!
Acquisition.Implicit,  # Uh, whatever.
AccessControl.Role.RoleManager # Security manager.
):
Boring object. 
meta_type = 'Boring' # what do people think they're adding?
manage_options = ( # what management options are there?
{'label': 'Edit',   'action': 'manage_main'},
{'label': 'View',   'action': ''}, # defaults to index_html
{'label': 'Security',   'action': 'manage_access'},
)

# NOTE: commented out following as it seem to conflict with 
#  'security.declareP...()' declarations later on
#__ac_permissions__=( # what permissions make sense for us?
#   ('View management screens', ('manage_tabs','manage_main')),
#   ('Change permissions',  ('manage_access',)   ),
#   ('Change Borings' , ('manage_edit',) ),
#   ('View Borings',('',)),
#   )

def __init__(self, id, title=''):
initialise a new instance of Boring
self.id = id
self.title = title

#   SECURITY -   
# here I played with '#'s, then simply tried to access 'index_html'
# after each security declaration,
# as user 'Anonymous', and noted the results on same line. 
# 'NOT-WORKING' simply means not working as advertised (allowed access when 
# it shouldn't, and vice-versa). As you can see, there are too many 
# 'NOT-WORKING' results. Do you come to similar results?
# My conclusion is that security declarations have no effect whatsoever,
# whether I declare something, then its oposite, I end up with the same
# result. This shouldn't be.

security.setPermissionDefault(READ_PERM,
['Stuff Manager','Manager'])
security.setDefaultAccess('deny')   #   == NOT-WORKING

#   security.declarePrivate('index_html')   #   == NOT-WORKING
#   security.declarePublic('index_html')#   == OK
#   security.declareProtected(READ_PERM, 'index_html') #  == NOT-WORKING

index_html = HTMLFile('index', globals())

security.declarePublic('manage_main')   #   == NOT-WORKING
manage_main = HTMLFile('boringEdit', globals())

def manage_edit(self, title, REQUEST=None):
 
self.title = title
if REQUEST is not None:
return MessageDialog(
title = 'Edited',
message = Properties for %s changed. % self.id,
action = './manage_main',
)

Globals.InitializeClass(Boring)



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



Re: [Zope-dev] Re: [Zope] Error on install

2002-01-18 Thread Eron Lloyd

Yeah, I caught that this morning. Seems like the test/ directory is causing 
more trouble than I though, huh ;-) ? I'm in the process of applying a custom 
patch to lib/python2.1/compileall.py that adds a new parameter and code suite 
to compile_dir() to accept a list of dir. names to skip over during the 
recursive traversal. This way we can specify to skip over test/ entirely 
(without deleting or moving it) and no matter how the installer changes, as 
long as it calls compileall.compile_dir() it should work. I'd like to change 
inst/compilezpy.py to import this custom module instead of looking at the 
standard library module (until perhaps I can have this merged into python's 
CVS?).

What's the best way to submit patchs (esp. multi-file ones?)  Also, are you 
going to (or have already) rebuild the binary packages for beta4 so linux 
users can test them? Most people won't know about this bug, and it's too 
small (and premature) to be a hotfix.

I should have something by the end of the weekend.

Eron

On Friday 18 January 2002 02:25 pm, you wrote:
 Eron Lloyd wrote:
 Chris (or anybody else),
 
 Have you tried to install Beta4 using the linux binary package yet? I'm
 trying to write a patch against it but the installation does in fact bomb
  out each time I try to run it, even freshly untarred. The source TGZ
  works fine and dandy, however. It seems compilezpy.py has been
  dramatically changed since Beta3, as if to try and surpress the stdout
  messages. I'm going to try and break it down and find out where the
  exceptions are flagging, and also refactor my patch so it doesn't depend
  on the changes being made to compilezpy.py. I don't like wrapping a gag
  around code if I don't have to, and I'd rather this stuff be written to
  an install log or something.
 
 I-see-a-fishbowl-proposal-for-a-new-installer-ly yours,
 
 Eron

 Hi Eron,

 One of the engineers snuck in a last minute change to fix the install
 process to not install if compilation of any module fails.  However, the
 test suite for Python itself has some modules that don't compile, and
 they're causing the newly fixed installer to complain.

 In the file inst/compilezpy.py, you can delete the section that says
 (starting at about line 45):

 if not success:
 

 to the end of the file and rerun the install program.

 This one was particularly aggravating because the beta 4 release is only
 supposed to include bugfixes, not 'features'.  Clearly, I distingush
 between a bug fix which fixes an existing problem causing Zope to not
 work vs a feature which causes an otherwise working Zope to cease
 functioning.  :)


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

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



[Zope-dev] Folding Zope Into an Install

2002-01-18 Thread Noah Friedland

Fellow Zopers:

I have recently completed a small app built on zope. I am trying to build an
inno setup install script that will install zope silently (with a
pre-determined master user/password). Any help on this would be greatly
appreciated.

--N


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