[Zope-dev] Confused by accuisition, need help

2001-04-08 Thread Robert Rottermann



Hi there,

I need the help with the following 
situation:

I have a folder test with the following 
structure
1 Test
a  
index_html 
some frames to structure the display
a  
zman
 (a product I am about to develop)
a 
data
b  
 projects
c 
data
acesses database
c  
  display 
 displayes the data
b 
 documents

c  
  data  
  acesses database 
c  
  display 
 displayes the data

(I hope you can still see the structure)

Now to display the records I use the following dtml-method(in the disply 
method):
 dtml-in 
expr="PARENTS[0].data()" 
OPTION selected value="dtml-var 
sequence-index" 
dtml-var sequence-item 
/OPTION /dtml-in
This works fine if I am in projects od dicuments

Now my problem:
in index_html I only would like to splice the various parts togezher. 


Like so:
some glue
 dtml-var 
expr="PARENTS[0].data.projects.show()" dtml-var 
expr="PARENTS[0].data.documents.show()"
/some glue

Unfortunatelly I get an erro in the display-methodr:
 Error Value: PARENTS
 (Object: PARENTS[0].data()) 
Obviously when called like this, the method knows nothing of its 
anchestry.
How kan I call methods that are in a "lower" folder, and have them know 
theyr environment?

Thanks for your help.

Robert


[Zope-dev] can't use manage_access (security/Roles) in ZOPE 2.3.1b3

2001-04-08 Thread Marcus Schopen

Hi,

can't manage security and roles in Zope's root folder any more. I'm not
sure if this error came up with upgrading from stable 2.3.1 to 2.3.1b3. 

Zope on Debian Linux:
Zope Version  Zope 2.3.1b3 (binary release, python 1.5.2, linux2-x86)  
Python Version  1.5.2 (#10, Dec 6 1999, 12:16:27) [GCC 2.7.2.3]  
System Platform  linux2 

When clicking on 'security' button in the root folder I get the
following error. Any help?

Thank you
Marcus


Traceback (innermost last):
  File /home/zope/Zope/lib/python/ZPublisher/Publish.py, line 223, in
publish_module
  File /home/zope/Zope/lib/python/ZPublisher/Publish.py, line 187, in
publish
  File /home/zope/Zope-2.3.0-linux2-x86/lib/python/Zope/__init__.py,
line 221, in zpublisher_exception_hook
(Object: ApplicationDefaultPermissions)
  File /home/zope/Zope/lib/python/ZPublisher/Publish.py, line 171, in
publish
  File /home/zope/Zope-2.3.0-linux2-x86/lib/python/ZPublisher/mapply.py,
line 160, in mapply
(Object: manage_access)
  File /home/zope/Zope/lib/python/ZPublisher/Publish.py, line 112, in
call_object
(Object: manage_access)
  File
/home/zope/Zope-2.3.0-linux2-x86/lib/python/AccessControl/Role.py, line
258, in manage_access
(Object: ApplicationDefaultPermissions)
  File
/home/zope/Zope-2.3.0-linux2-x86/lib/python/Shared/DC/Scripts/Bindings.py,
line 324, in __call__
(Object: _normal_manage_access)
  File
/home/zope/Zope-2.3.0-linux2-x86/lib/python/Shared/DC/Scripts/Bindings.py,
line 353, in _bindAndExec
(Object: _normal_manage_access)
  File /home/zope/Zope-2.3.0-linux2-x86/lib/python/App/special_dtml.py,
line 236, in _exec
(Object: _normal_manage_access)
  File
/home/zope/Zope-2.3.0-linux2-x86/lib/python/DocumentTemplate/DT_With.py,
line 146, in render
(Object: _.namespace(valid_roles=valid_roles()))
  File /home/zope/Zope/lib/python/DocumentTemplate/DT_In.py, line 646,
in renderwob
(Object: permission_settings)
  File
/home/zope/Zope-2.3.0-linux2-x86/lib/python/AccessControl/Role.py, line
182, in permission_settings
(Object: ApplicationDefaultPermissions)
  File
/home/zope/Zope-2.3.0-linux2-x86/lib/python/AccessControl/Role.py, line
177, in lambda
TypeError: (see above)


-- 

_

  (0   Marcus Schopen
  //\   Bielefeld, Germany
  V_/_
_

___
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] ZCatalog bug?

2001-04-08 Thread Adam Chlipala

I have just installed Zope 2.3.1 and the latest CMF.  When trying to
publish some CMF resource after submitting a form to edit the site
config, I get a TypeError: expected integer key.  The stack traceback is
included below.  A more experienced user has said that this looks like
it could be because of a bug in ZCatalog.  I'd like to stress that this
is literally the first thing I'm doing with Zope, so there's not much to
do to reproduce the setup. :-)  Does anyone have any guesses about why
this is happening?  Thanks.

Traceback (innermost last):
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/ZPublisher/Publish.py,
line 223, in publish_module
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/ZPublisher/Publish.py,
line 187, in publish
  File /usr/local/stow/zope-2.3.1/lib/zope/lib/python/Zope/__init__.py,
line 221, in zpublisher_exception_hook
(Object: Traversable)
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/ZPublisher/Publish.py,
line 171, in publish
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/ZPublisher/mapply.py,
line 160, in mapply
(Object: reconfig)
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/ZPublisher/Publish.py,
line 112, in call_object
(Object: reconfig)
  File /var/lib/zope/Products/CMFCore/FSDTMLMethod.py, line 218, in
__call__
(Object: reconfig)
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/DocumentTemplate/DT_String.py,
line 538, in __call__
(Object: reconfig)
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/DocumentTemplate/DT_Return.py,
line 106, in render
(Object: reconfig_form(_.None, _, portal_status_message='Settings
changed'))
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/DocumentTemplate/DT_Util.py,
line 334, in eval
(Object: reconfig_form(_.None, _, portal_status_message='Settings
changed'))
(Info: _)
  File string, line 0, in ?
  File /var/lib/zope/Products/CMFCore/FSDTMLMethod.py, line 213, in
__call__
(Object: reconfig_form)
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/DocumentTemplate/DT_String.py,
line 538, in __call__
(Object: reconfig_form)
  File /var/lib/zope/Products/CMFCore/FSDTMLMethod.py, line 213, in
__call__
(Object: standard_html_header)
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/DocumentTemplate/DT_String.py,
line 538, in __call__
(Object: standard_html_header)
  File /var/lib/zope/Products/CMFCore/FSDTMLMethod.py, line 213, in
__call__
(Object: actions_box)
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/DocumentTemplate/DT_String.py,
line 538, in __call__
(Object: actions_box)
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/DocumentTemplate/DT_Let.py,
line 146, in render
(Object: isAnon="portal_membership.isAnonymousUser()"
  AuthClass="isAnon and 'GuestActions' or 'MemberActions'"
  uname="isAnon and 'Guest'
 or
portal_membership.getAuthenticatedMember().getUserName()"
  obj="this()"
  actions="portal_actions.listFilteredActionsFor(obj)"
  user_actions="actions['user']"
  folder_actions="actions['folder']"
  object_actions="actions['object'] + actions['workflow']"
  global_actions="actions['global']")
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/DocumentTemplate/DT_Util.py,
line 334, in eval
(Object: portal_actions.listFilteredActionsFor(obj))
(Info: portal_actions)
  File string, line 0, in ?
  File /var/lib/zope/Products/CMFCore/ActionsTool.py, line 162, in
listFilteredActionsFor
(Object: portal_actions)
  File /var/lib/zope/Products/CMFCore/WorkflowTool.py, line 222, in
listActions
(Object: portal_workflow)
  File /var/lib/zope/Products/CMFCore/DefaultWorkflow.py, line 209, in
listGlobalActions
  File /var/lib/zope/Products/CMFCore/CatalogTool.py, line 200, in
searchResults
(Object: Traversable)
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/Products/ZCatalog/ZCatalog.py,
line 535, in searchResults
(Object: Traversable)
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/Products/ZCatalog/Catalog.py,
line 651, in searchResults
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/Products/ZCatalog/Catalog.py,
line 542, in _indexedSearch
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/SearchIndex/UnTextIndex.py,
line 513, in _apply_index
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/SearchIndex/UnTextIndex.py,
line 576, in query
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/SearchIndex/UnTextIndex.py,
line 640, in evaluate
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/SearchIndex/UnTextIndex.py,
line 591, in get_operands
  File
/usr/local/stow/zope-2.3.1/lib/zope/lib/python/SearchIndex/UnTextIndex.py,
line 448, in __getitem__
TypeError: (see above)

-- Adam Chlipala
   [EMAIL PROTECTED]
   http://home.devlocus.org/~psion/
   ICQ UIN: 489166
   AIM: PsionV
   If God does not exist, then anything is permitted.
   ...
   I am the Word that speaks Itself
   I am 

Re: [Zope-dev] ZPatterns, DataSkins, forms and errorchecking/handling

2001-04-08 Thread Itai Tavor

Kapil wrote:

Thanks, Kapil. I did look at dtml-contract, and it wasn't hard to 
understand it from the docs. But the problem is that it can't cover 
all the required tests - like dependencies between several form 
fields (such as with two password fields) or tests outside the form 
content (such as ensuring that a new product doesn't have an SKU that 
already exists, or that a user does not register with an existing 
email address). So a specific validation is required anyway. Also, 
all my form action is done in methods of Python Products where 
dtml-contract is not usable.

Itai


On Tuesday 27 March 2001 17:40, Itai Tavor wrote:
Hi,

I'm trying to work out the best way to check for and report errors
when DataSkin objects are created/edited, but I'm having a lot of
problems.

For form validation, Zope's build-in constraints are pretty
useless... things like ValueHandler are a little better, but IMO not
good enough. When a user types incorrect data in a form, I don't want
to display a page with a list of errors and say "click Back to fix
your errors". I want to return the form, with a list of errors and
the bad fields highlighted. So I need to perform field checks in the
form action method and in case of errors call the original form,
giving it an error list.

I know that to ensure that object data is always valid I should
validate the object in a SkinScript, using WHEN OBJECT ADDED,CHANGED
call self.validate(), and raise an exception in validate in case of a
problem. But this can't deal with returning the original form. It can
only display error pages, and to display nicely formatted error pages
it has to return a DTML Method so I can use dtml-raise, rather than
directly do raise in validate.

So I'm looking at a validate method for use at commit time, a
show_errors DTML Method, and a validate_form to call from the form
action method...

The validate_form method is defined in the DataSkin class. But it is
also used when a new object is created from a form, so it needs to be
called from a Specialist before the object is created, so I need to
import it in the Specialist. But this method might use other methods
of the DataSkin class, so I need to import those too...

So, to sum up, I need a method used in commit time, that renders a
DTML method to raise an error message, another method to verify form
submissions and return the form with error messages, and I need to
import that method and all other methods it uses into the Specialist.
This seems too much work...

Can anyone suggest a simpler approach (one that still retains the
ability to return the original form in case of errors)?

check out dtml-contract.

sample form processor with dtml contract

dtml-contract
this page retrieves records from the db based on user input
dtml-params
foo:int,optional
bar:date
foobar:range(int, 0,10)
dtml-exceptions
bad_user_input
/dtml-contract

user gets redirected if bar is not a valid date string, and foobar is not a
integer compatible string between 0 and 10. if foo is present it must be a
integer compatible string (compatible means coercible via int(foo)). if any
of these things does not happen than all the collected errors for the page
are sent to the error handler bad_user_input. this is not a redirect, the
error handler is evaluated in the context of the page with an additonal value
added to the namespace to denote the list of errors. page processing stops
after evaluation of the tag if an error occurs.

this may be clear as mud, i don't know, i tried to make the included
documentation pretty inclusive and readable, its not completely insync with
the code but it does elaborate on the feature set pretty well. if you have
specific questions feel free to ask.

so in your case you can just use the original form as the error handler and
add logic to it to insert the values if they already exist in the request,
and display error messages to the user on the particular vars that have
problems based on the existence of the special error variable.

hth

kapil


TIA, Itai

-- 
--
Itai Tavor  -- "Je sautille, donc je suis."--
[EMAIL PROTECTED]--   - Kermit the Frog --
-- --
-- "If you haven't got your health, you haven't got anything"  --


___
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] DTMLOverride

2001-04-08 Thread R. David Murray

I came across a need to modify a couple DTML Methods of a Product I was
using.  (It's my own product, but ignore that for now grin).  I didn't
want to modify the code of the product, because then I'd loose changes
if I upgraded the product.  First I just wrote a little product whose
init method went in an repointed the appropriate methods to new DTMLFile
objects.  But that doesn't work with Refresh.  So instead I wrote
a little product that modifies the __init__ method of ClassicHTMLFile
to check a configuration file to see if there is an alternate source
specified.

This is a proof-of-concept thing, as I'm not sure how useful such
a facility is (I have a use for it in mind with regards to EMarket,
but I haven't tried it out yet to see if it's really a good way to
reach my goal there).  So comments of the type: "cool idea",
"terrible idea" (and why), are welcome.

The product is at http://www.zope.org/Members/rdmurray/DTMLOverride

--RDM


___
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] Confused by accuisition, need help

2001-04-08 Thread Lalo Martins

On Sun, Apr 08, 2001 at 11:14:51PM +0200, Robert Rottermann wrote:
 Hi there,
 
 I need the help with the following situation:

The easiest way is to make more use of DTML and not try to bend
it so much:


   dtml-in expr="PARENTS[0].data()"
 OPTION selected value="dtml-var sequence-index"
   dtml-var sequence-item
 /OPTION
   /dtml-in

Instead, try just dtml-in data.


 Now my problem:
 in index_html I only would like to splice the various parts togezher. 
 
 Like so:
 some glue
 dtml-var expr="PARENTS[0].data.projects.show()"
 dtml-var expr="PARENTS[0].data.documents.show()"
 /some glue

Try this:

 some glue
 dtml-with data
 dtml-with projects
 dtml-var show
 /dtml-with
 dtml-with documents
 dtml-var show
 /dtml-with
 /dtml-with
 /some glue

Or something like that.

When you call stuff with "name=" instead of "expr=", you let
DocumentTemplate do the calling for you, and then your methods
will be called with the correct parameters.

[]s,
   |alo
   +
--
   I say a prayer now our love's departed
That you'll come back to stay
  Bring back the perfect day

http://www.laranja.org/mailto:[EMAIL PROTECTED]
 pgp key: http://www.laranja.org/pessoal/pgp

Brazil of Darkness (RPG)  ---   http://www.BroDar.org/

___
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] Confused by accuisition, need help

2001-04-08 Thread Lalo Martins

BTW - you're not confused by Acquisition, you're confused by
DocumentTemplate's calling conventions (you can't call it with
zero parameters, not if you want it to work anyway)

[]s,
   |alo
   +
--
   I say a prayer now our love's departed
That you'll come back to stay
  Bring back the perfect day

http://www.laranja.org/mailto:[EMAIL PROTECTED]
 pgp key: http://www.laranja.org/pessoal/pgp

Brazil of Darkness (RPG)  ---   http://www.BroDar.org/

___
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] ZCatalog bug?

2001-04-08 Thread Tres Seaver

Adam Chlipala [EMAIL PROTECTED] wrote:

 I have just installed Zope 2.3.1 and the latest CMF.  When trying to
 publish some CMF resource after submitting a form to edit the site
 config, I get a TypeError: expected integer key.  The stack traceback is
 included below.  A more experienced user has said that this looks like
 it could be because of a bug in ZCatalog.  I'd like to stress that this
 is literally the first thing I'm doing with Zope, so there's not much to
 do to reproduce the setup. :-)  Does anyone have any guesses about why
 this is happening?  Thanks.
 
 Traceback (innermost last):
   File
 /usr/local/stow/zope-2.3.1/lib/zope/lib/python/ZPublisher/Publish.py,
 line 223, in publish_module
   File
 /usr/local/stow/zope-2.3.1/lib/zope/lib/python/ZPublisher/Publish.py,
 line 187, in publish
   File /usr/local/stow/zope-2.3.1/lib/zope/lib/python/Zope/__init__.py,
 line 221, in zpublisher_exception_hook
 (Object: Traversable)
   File
 /usr/local/stow/zope-2.3.1/lib/zope/lib/python/ZPublisher/Publish.py,
 line 171, in publish
   File
 /usr/local/stow/zope-2.3.1/lib/zope/lib/python/ZPublisher/mapply.py,
 line 160, in mapply
 (Object: reconfig)
   File
 /usr/local/stow/zope-2.3.1/lib/zope/lib/python/ZPublisher/Publish.py,
 line 112, in call_object
 (Object: reconfig)
   File /var/lib/zope/Products/CMFCore/FSDTMLMethod.py, line 218, in
 __call__
 (Object: reconfig)
   File
 /usr/local/stow/zope-2.3.1/lib/zope/lib/python/DocumentTemplate/DT_String.py,
 line 538, in __call__
 (Object: reconfig)
   File
 /usr/local/stow/zope-2.3.1/lib/zope/lib/python/DocumentTemplate/DT_Return.py,
 line 106, in render
 (Object: reconfig_form(_.None, _, portal_status_message='Settings
 changed'))
   File
 /usr/local/stow/zope-2.3.1/lib/zope/lib/python/DocumentTemplate/DT_Util.py,
 line 334, in eval
 (Object: reconfig_form(_.None, _, portal_status_message='Settings
 changed'))
 (Info: _)
   File string, line 0, in ?
   File /var/lib/zope/Products/CMFCore/FSDTMLMethod.py, line 213, in
 __call__
 (Object: reconfig_form)

snip

   File
 /usr/local/stow/zope-2.3.1/lib/zope/lib/python/SearchIndex/UnTextIndex.py,
 line 448, in __getitem__
 TypeError: (see above)

Yes this is a catalog bug, which is fixed in CVS.  You can, in this
case, safely ignore it, and continue using the portal (your configuration
changes may not have been saved, however).

Tres.
-- 
===
Tres Seaver[EMAIL PROTECTED]
Digital Creations "Zope Dealers"   http://www.zope.org

___
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] Cause for Zope 2.3.1 hang-ups found

2001-04-08 Thread Stephan Richter

Hello everyone,

I think I found the reason for Zope 2.3.1 hangung up from time to time: It 
is Zope 2.3.1 and the CoreSessionTracking Product 0.7.0 together. I 
installed now the latest version 0.8. It did not work out of the box for 
me, but after correcting the code at two locations, it worked. I am not 
sure wether it will stop the hang-ups, but I try to do some testing later 
on using wget again.

Regards,
Stephan

--
Stephan Richter
CBU - Physics and Chemistry Student
Web2k - Web Design/Development  Technical Project Management


___
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] Cause for Zope 2.3.1 hang-ups found

2001-04-08 Thread Chris McDonough

Stephan,

Thanks for the report.

What leads you to believe that cst 0.7 causes a hangup?

Relatedly, how did 0.8 not work out of the box, and what
changes did you make that allowed it to work for you?

- C




On Sun, 08 Apr 2001 22:58:26 -0500
 Stephan Richter [EMAIL PROTECTED] wrote:
 Hello everyone,
 
 I think I found the reason for Zope 2.3.1 hangung up from
 time to time: It 
 is Zope 2.3.1 and the CoreSessionTracking Product 0.7.0
 together. I 
 installed now the latest version 0.8. It did not work out
 of the box for 
 me, but after correcting the code at two locations, it
 worked. I am not 
 sure wether it will stop the hang-ups, but I try to do
 some testing later 
 on using wget again.
 
 Regards,
 Stephan
 
 --
 Stephan Richter
 CBU - Physics and Chemistry Student
 Web2k - Web Design/Development  Technical Project
 Management
 
 
 ___
 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 )