[Zope] Re: Problem Creating Instance

2006-11-28 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Nancy Donnelly wrote:
> Hi;
> I built Z3 from FreeBSD ports. Went to create an instance and got this error:
> 
> [EMAIL PROTECTED]:ports/www/zope3 (115) 
> /usr/local/www/Zope3/bin/mkzopeinstance -d /usr/local/www/Zope3/main
> Traceback (most recent call last):
>   File "/usr/local/www/Zope3/bin/mkzopeinstance", line 47, in 
> from zope.app.server.mkzopeinstance import main
>   File "/usr/local/www/Zope3/lib/python/zope/app/server/mkzopeinstance.py", 
> line 32, in 
> from zope.app.authentication import password
>   File "/usr/local/www/Zope3/lib/python/zope/app/authentication/__init__.py", 
> line 19, in 
> import interfaces
>   File 
> "/usr/local/www/Zope3/lib/python/zope/app/authentication/interfaces.py", line 
> 22, in 
> import zope.security.interfaces
>   File "/usr/local/www/Zope3/lib/python/zope/security/__init__.py", line 24, 
> in 
> from zope.security.management import checkPermission
>   File "/usr/local/www/Zope3/lib/python/zope/security/management.py", line 
> 25, in 
> from zope.security.interfaces import ISecurityManagement
>   File "/usr/local/www/Zope3/lib/python/zope/security/interfaces.py", line 
> 20, in 
> from zope.interface.common.interfaces import IAttributeError
>   File "/usr/local/www/Zope3/lib/python/zope/interface/common/interfaces.py", 
> line 80, in 
> classImplements(OverflowWarning, IOverflowWarning)
> NameError: name 'OverflowWarning' is not defined
> 
> Now, apparently there is a vulnerability with Z3, so I could only make with 
> this thrown in:
> DISABLE_VULNERABILITIES=yes
> TIA,
> Nancy

I'm guessing you are using some antique Python version here.
OverflowWarning is a builtin in the versions of Python required by *all*
released versions of Zope3:

$ python
Python 2.4.3 (#2, Oct  6 2006, 07:52:30)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> OverflowWarning

>>>
[/home/tseaver]
$ python2.3
Python 2.3.5 (#2, Oct  5 2006, 22:06:14)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> OverflowWarning

>>>


If the FreeBSD port for Zope doesn't mandate a Python >= 2.3.x, it is
severely broken.

BTW, I have no idea what "vulnerability" you are describing here.


Tres.
- --
===
Tres Seaver  +1 202-558-7113  [EMAIL PROTECTED]
Palladion Software   "Excellence by Design"http://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFbNZ3+gerLs4ltQ4RAtwXAKC941JNHqpQ46T//X1jmWH09FMLlgCfal+j
7yWBI3sH7QkVaUFasf3igec=
=1pm5
-END PGP SIGNATURE-

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


Re: [Zope] Existence and truth

2006-11-28 Thread Chris Withers

Paul Winkler wrote:

On Tue, Nov 28, 2006 at 10:24:51PM +, Mark Barratt wrote:

The radio inputs return name="listed" and value 0 or 1


If you change that radio input to name="listed:int" you'll get the 
behaviour you expect...


cheers,

Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

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


Re: [Zope] Existence and truth

2006-11-28 Thread Mark Barratt

Mark Barratt wrote:

Paul Winkler wrote:


This kind of thing is usually a mistaken type assumption.
I bet your radiobutton is setting it to "0" rather than 0.



Thanks. Yes it was. But neither value=0 (which I think is invalid 
XHTML), nor value="" makes any difference.


OK, solved. value="" actually works - some kind of cacheing issue seems 
to have misled me when first testing it.


Again, thanks.

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

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


Re: [Zope] Existence and truth

2006-11-28 Thread Mark Barratt

Terry Brown wrote:


Hmmm, CGI only returns strings.  Sometimes x*1 will give a number (0) 
even if x is a string ("0")... but I would have said your example should 
work...


Yes, that's what i would have thought . I'll move this to the 
Plone users list - there may be some specific Plone evil involved, 
though I don't see how.


Thanks for the input.

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

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


Re: [Zope] Existence and truth

2006-11-28 Thread Terry Brown


Hmmm, CGI only returns strings.  Sometimes x*1 will give a number 
(0) even if x is a string ("0")... but I would have said your 
example should work...


Cheers -Terry
x
On Tue, 28 Nov 2006, Mark Barratt wrote:


Paul Winkler wrote:


This kind of thing is usually a mistaken type assumption.
I bet your radiobutton is setting it to "0" rather than 0.



Thanks. Yes it was. But neither value=0 (which I think is invalid XHTML), nor 
value="" makes any difference.


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



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

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


Re: [Zope] Existence and truth

2006-11-28 Thread Mark Barratt

Paul Winkler wrote:


This kind of thing is usually a mistaken type assumption.
I bet your radiobutton is setting it to "0" rather than 0.



Thanks. Yes it was. But neither value=0 (which I think is invalid 
XHTML), nor value="" makes any difference.


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

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


Re: [Zope] Existence and truth

2006-11-28 Thread Paul Winkler
On Tue, Nov 28, 2006 at 10:24:51PM +, Mark Barratt wrote:
> The radio inputs return name="listed" and value 0 or 1
> 
> This works OK, but in the radio input code,
> 
> tal:attributes="checked python:test(listed,'checked',None);
> 
> *always* returns 'checked'

(snip)

> So what basic fact/knowledge am I missing?

This kind of thing is usually a mistaken type assumption.
I bet your radiobutton is setting it to "0" rather than 0.


-- 

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


[Zope] Existence and truth

2006-11-28 Thread Mark Barratt

[profound subject: sorry the body may be less interesting]

This is so basic, but any help would be appreciated. It's also a Plone 
site, but the problem is about basic tal behaviour so I hope it's 
appropriate:


I have an attribute, 'listed' (a property of 'member') which I want the 
user to be able to set or unset with a radio choice rather than by 
checking or unchecking a checkbox, as provided in default join_form and 
personalize_form.


In personalize_form, I define listed like this:
listed python:request.get('listed', member.getProperty('listed',''))

The radio inputs return name="listed" and value 0 or 1

This works OK, but in the radio input code,

tal:attributes="checked python:test(listed,'checked',None);

*always* returns 'checked'

and the second of these debug lines is *always* displayed, whether 
listed is 0 or 1:


debug: value of listed, after define with getProperty=tal:content="listed">value


debug: this para should print if 
listed is true, ie equals 1


Appendix C of the Zope Book says tal:condition tests for existence and 
truth, and "missing variables, None, zero, empty strings, and empty 
sequences false; all other values are true".


So what basic fact/knowledge am I missing?

Thanks

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

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


Re: [Zope] Problem Creating Instance

2006-11-28 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



- --On 28. November 2006 11:29:41 -0800 Nancy Donnelly 
<[EMAIL PROTECTED]> wrote:

> Hi;
> I built Z3 from FreeBSD ports. Went to create an instance and got this
> error:


Real men/girls build Zope from the sources. Better ask on the zope3-users 
list.

- -aj
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFFbKhwCJIWIbr9KYwRAlRYAJ9PHJcj5OMAviTxk1eG+RzF+Ep4VACgsMNR
Fp2QyfXlpixK0wFKRmUmDDY=
=mfVs
-END PGP SIGNATURE-

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


Re: [Zope] a question about aq_base

2006-11-28 Thread Dieter Maurer
Yuri wrote at 2006-11-28 14:23 +0100:
> here: http://docs.neuroinf.de/programming-plone/ate we can read:
>
> 
>
>obj = brain.getObject().aq_base
>
>why .aq_base and not only brain.getObject()? :)

Usually, it is a bad idea to use "aq_base" in Zope applications
(there are special cases where it is the right thing though).
The reason: Zope usually expects to work with acquisition wrapped objects.
"aq_base" discards the acquisition context.


You should carefully examine the context of the code fragment above.
Maybe, the context is one of the rare situations where "aq_base"
is called for...



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


[Zope] Problem Creating Instance

2006-11-28 Thread Nancy Donnelly
Hi;
I built Z3 from FreeBSD ports. Went to create an instance and got this error:

[EMAIL PROTECTED]:ports/www/zope3 (115) /usr/local/www/Zope3/bin/mkzopeinstance 
-d /usr/local/www/Zope3/main
Traceback (most recent call last):
  File "/usr/local/www/Zope3/bin/mkzopeinstance", line 47, in 
from zope.app.server.mkzopeinstance import main
  File "/usr/local/www/Zope3/lib/python/zope/app/server/mkzopeinstance.py", 
line 32, in 
from zope.app.authentication import password
  File "/usr/local/www/Zope3/lib/python/zope/app/authentication/__init__.py", 
line 19, in 
import interfaces
  File "/usr/local/www/Zope3/lib/python/zope/app/authentication/interfaces.py", 
line 22, in 
import zope.security.interfaces
  File "/usr/local/www/Zope3/lib/python/zope/security/__init__.py", line 24, in 

from zope.security.management import checkPermission
  File "/usr/local/www/Zope3/lib/python/zope/security/management.py", line 25, 
in 
from zope.security.interfaces import ISecurityManagement
  File "/usr/local/www/Zope3/lib/python/zope/security/interfaces.py", line 20, 
in 
from zope.interface.common.interfaces import IAttributeError
  File "/usr/local/www/Zope3/lib/python/zope/interface/common/interfaces.py", 
line 80, in 
classImplements(OverflowWarning, IOverflowWarning)
NameError: name 'OverflowWarning' is not defined

Now, apparently there is a vulnerability with Z3, so I could only make with 
this thrown in:
DISABLE_VULNERABILITIES=yes
TIA,
Nancy



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


Re: [Zope] making a dynamic quiz help

2006-11-28 Thread Jonathan


- Original Message - 
From: "Thomas Bennett" <[EMAIL PROTECTED]>

To: 
Sent: Tuesday, November 28, 2006 1:40 PM
Subject: [Zope] making a dynamic quiz help



I would like some suggestions on building a dynamic quiz.

 There are categories and in each category the question can be multiple
choice or true/false.   For each category a specific number of questions 
is

asked.  The questions asked are randomly chosen from a collection of
questions for the category.  The number of questions chosen may be 
different

for each category.

example
 category one - 3 questions
 category two - 1 question
 category three - 2 questions

My first thought is a python script does the randomization selecting 
questions
from my postgresql database.  Quizzes submitted updates the database 
counting

correct and wrong answers and emails the results to the student and
instructors.

A second thought is a python script builds a dtml page quiz from 
individual
dtml files which categories can be folders with an individual dtml file 
for

each question.  Then submit questions and answers to database and email
student and instructors.

A third thought is create a collection of complete quizzes and then 
randomly

select a quiz (least preferred).

I've searched and the closest I could find was on the zope edu wiki just
discussing an aggregated quiz but I haven't found where that has been
persued.   Most or all quiz products create static quizzes not one that 
can

be built "on the fly".  Any other designs would be appreciated.


If I was building this app I would have a dtml method (or ZPT, whatever you 
are most comfortable with) that invokes a python script (or external method) 
to provide data for the dtml/zpt form fields.  A second dtml method/zpt 
would be used as the form processor, it would invoke a python 
script/external method to process the form data input by the user (update 
db, send email, whatever) and then display some confirmation/thank you 
message to the user.


Pretty straightforward app.

Have fun!

Jonathan 



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

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


[Zope] making a dynamic quiz help

2006-11-28 Thread Thomas Bennett
I would like some suggestions on building a dynamic quiz.

  There are categories and in each category the question can be multiple 
choice or true/false.   For each category a specific number of questions is 
asked.  The questions asked are randomly chosen from a collection of 
questions for the category.  The number of questions chosen may be different 
for each category.

example
  category one - 3 questions
  category two - 1 question
  category three - 2 questions

My first thought is a python script does the randomization selecting questions 
from my postgresql database.  Quizzes submitted updates the database counting 
correct and wrong answers and emails the results to the student and 
instructors.

A second thought is a python script builds a dtml page quiz from individual 
dtml files which categories can be folders with an individual dtml file for 
each question.  Then submit questions and answers to database and email 
student and instructors.

A third thought is create a collection of complete quizzes and then randomly 
select a quiz (least preferred).

I've searched and the closest I could find was on the zope edu wiki just 
discussing an aggregated quiz but I haven't found where that has been 
persued.   Most or all quiz products create static quizzes not one that can 
be built "on the fly".  Any other designs would be appreciated.

Thanks,

Thomas

-- 

Thomas McMillan Grant Bennett   Appalachian State University
Computer Consultant III P O Box 32026
University Library  Boone, North Carolina 28608
(828) 262 6587

If it's not as simple as possible to try it, then the barrier to entry is too 
high.

Library Systems Help Desk: http://www.library.appstate.edu/help/

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


Re: [Zope] Re: error with simple python script loop

2006-11-28 Thread Chris Withers

Paul Winkler wrote:

I still prefer zdb, because you can actually see and step through the
script code.
http://www.simplistix.co.uk/software/zope/zdb


It also includes the security declarations necessary to import it from 
untrusted code :-)


Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

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


Re: [Zope] a question about aq_base

2006-11-28 Thread Jens Vagelpohl

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 28 Nov 2006, at 14:23, Yuri wrote:


Hi!

here: http://docs.neuroinf.de/programming-plone/ate we can read:


   obj = brain.getObject().aq_base

why .aq_base and not only brain.getObject()? :)


You are not presenting this one line in its context. No one will be  
able to tell you whether that is necessary wherever it is mentioned,  
because no one knows the stuff you omitted.


In normal situations "getObject" is all you need. I don't know any  
standard situation where you would not want the returned object  
acquisition-wrapped.


jens


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFFbHEyRAx5nvEhZLIRAnC3AJ9bwRC7ca3l+1KKA1F1M6cN9972RACglzQI
QaSWjPJb6566aB1AHY+kZAI=
=HOTR
-END PGP SIGNATURE-
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

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


Re: [Zope] Re: error with simple python script loop

2006-11-28 Thread Paul Winkler
On Tue, Nov 28, 2006 at 08:28:47AM +, Maurits van Rees wrote:
> Christian Steinhauer, on 2006-11-24:
> > i cant use pdb on zope?s python script i think?
> 
> You can, if you put this small (two lines) program in your Products
> dir:
> 
> svn://svn.zope.org/repos/main/Products.enablesettrace
> 
> Not meant for production sites.

I still prefer zdb, because you can actually see and step through the
script code.
http://www.simplistix.co.uk/software/zope/zdb

-- 

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


[Zope] a question about aq_base

2006-11-28 Thread Yuri

Hi!

here: http://docs.neuroinf.de/programming-plone/ate we can read:



   obj = brain.getObject().aq_base

why .aq_base and not only brain.getObject()? :)


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

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


[Zope] Re: error with simple python script loop

2006-11-28 Thread Maurits van Rees
Christian Steinhauer, on 2006-11-24:
> i cant use pdb on zopeĀ“s python script i think?

You can, if you put this small (two lines) program in your Products
dir:

svn://svn.zope.org/repos/main/Products.enablesettrace

Not meant for production sites.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

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