Instead of ...




Chip Johansen

>From: "Bowyer, Alex" <[EMAIL PROTECTED]>
>Subject: [Zope] Help wanted on Zope ZClasses/DTML please.
>Date: Fri, 3 Nov 2000 16:05:49 +1100
>I have only just started developing in Zope over this last week. I like it 
>lot, but I am having problems finding solutions to some of my more specific
>problems in the various zope documentations. I am hoping that if I describe
>my problems, one of you more-experienced Zope users out there will be able
>to help me.
>First some background:
>Basically I have written a news page which allows you to add/edit/delete
>articles from it. It is similar in some ways to the Zope HowTo "Build a
>searchable job board". It revolves around two classes:
>(UA stands for Update Australia, the name of the news page)
>UAArticle : A single article, to be included on the page.
>  article_title,article_author and article_text (self-explanatory)
>DTML Methods:
>  index_html - renders the data from the three properties into HTML ready 
>inclusion in the news page
>  edit - a page with a form to allow you to modify the content, submits to
>  update - processes the form results from "edit", updates the properties 
>UAPage : the page itself, inherits from ObjectManager and has Add UAArticle
>permission defined. Each instance contains 0 or more UAArticles.
>  issue_date, issue_number, intro_text (self-explanatory)
>  index_html - renders the page to HTML, both from these properties and by
>calling the index_html of each subcomponent UAArticle.
>  edit - a set of forms for modifications to edit the above three 
>and add a new article, or select an article to edit or delete.
>  update - processes updates to the UAPage properties that have been made 
>the edit page.
>  edit_article - once an article is selected and the Edit button is 
>this finds the article, calls the edit method and gives feedback.
>  add_article - a form to create a new article and add it to the UAPage.
>  create_article - processes the data from the add_article form and 
>makes the object and adds it.
>  delete_article - once an article is selected and the Delete button is
>clicked, this finds the article, deletes it and gives feedback.
>Now to the problems I have got:
>1) I cannot get my delete_article method to work. I figured I need to use
>manage_delObjects, but I can't find a working example to copy from and my
>code doesn't seem to do anything. The following code gets called by a form
>with a field called article_to_delete which is the title of the article we
>want to delete:
><dtml-var standard_html_header>
><!-- set a flag to NULL, change it if found -->
><dtml-call "REQUEST.set('id_to_delete','NULL')">
><!-- get the title of the article to delete -->
><dtml-let the_match="REQUEST['article_to_delete']">
><!-- search for the article -->
><dtml-in objectValues>
>   <dtml-with sequence-item><dtml-with propertysheets><dtml-with
>   <dtml-if expr="article_title==the_match">
>     <dtml-call "REQUEST.set('id_to_delete',title_or_id)">
>     <!-- found it, update the flag -->
>   </dtml-if>
>   </dtml-with></dtml-with></dtml-with>
><!-- test the flag to see if found -->
><dtml-if expr="REQUEST['id_to_delete']=='NULL'">
>   <!-- not found -->
>   <h2>Article not found</h2>
>   <P>Could not find the article to delete.</P><P><A HREF=edit>Return to
>maintenance page</A></P>
>   <!-- found -->
>   <dtml-let the_id="REQUEST['id_to_delete']">
>   <!-- do the deletion - this is the bit that doesn't work -->
>   <dtml-call "manage_delObjects('the_id')">
>   <h2>Article deleted</h2>
>   <P>Deleted article '&dtml-the_match;' (id='&dtml-the_id;').</P><P><A
>HREF=edit>Return to maintenance page</A></P>
>   </dtml-let>
><dtml-var standard_html_footer>
>This gets an error that the_id does not exist. But I can't put <dtml-call
>"manage_delObjects('REQUEST['id_to_delete']')"> because that is quotes
>within quotes within quotes. I also tried  <dtml-with the_id><dtml-call
>"manage_delObjects()"></dtml-with> but that doesn't seem to do anything.
>What is the correct way to use manage_delObjects?
>2) I need to be able to make a "Back" button on the UAArticle's edit page
>that will return to the UAPage's edit page. The problem is that if I use <A
>HREF=edit> it just goes to the edit page of the object, because our current
>location is within the UAArticle not the UAPage. Is there a way to get the
>name of an object's parent (or its own name for that matter) and use it to
>construct a URL?
>3) When redirecting or linking to a page I have already visited, how can I
>force a refresh? I tried the JavaScript window.location.reload(true) but I
>think that is only supported by Netscape. It didn't work in IE5 for me
>4) What is the best way to handle security with ZClasses. In my example I
>want the index_html pages to be public but everything else to require a
>password. I managed to require a password for a particular instance of the
>UAPage, but that affects both the index_html and the edit pages.
>Thanks very much for taking the time to read this - I hope someone can put
>me out of my misery! - I have been fiddling around with the code for ages,
>getting nowhere fast, and the documentation wasn't much help in these 
>It just seems to cover the basics of ZClasses.
>Alex Bowyer
>IT Contractor, Logica Australasia
>Tel    : +61 2 9202 8130
>Fax    : +61 2 9922 7466
>WWW    :
>Zope maillist  -  [EMAIL PROTECTED]
>**   No cross posts or HTML encoding!  **
>(Related lists -
> )

Get Your Private, Free E-mail from MSN Hotmail at

Share information about yourself, create your own public profile at

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to