RE: [Zope] Help wanted on Zope ZClasses/DTML please.

2000-11-06 Thread Bowyer, Alex

Thanks for the e-mail Seb. I am afraid I am still having problems here, so I
will show my code again, and hopefully you or someone else will be able to
help.

To recap : I am creating a news page and an interface to edit it using two
custom ZClasses, Article and Page. A Page object contains several Articles.
The following code is from a script that allows the user to delete an
Article from the Page. This method belongs to the Page class, so we are
currently in the scope of the Page. This script is supplied with the title
of a news article to be deleted, it should then delete the Article from the
Page and report back.








  
  
  
  
  


  
  
  
  

  
  

  



  Article not found
  Could not find the article to delete.Return to
maintenance page

  Article not deleted
  Deleted article '&dtml-the_match;' (id='&dtml-the_id;').Return to maintenance page





Basically I think I am somehow passing the wrong parameters to
manage_delObjects

The line
  
causes an error 'loop over non-sequence'

This made me think that the argument has to be a sequence so I tried
  
but this fails because as you say it looks for an object called the_id and I
need to pass in the value of the_id not the name of it.

Ideally I want to say

but again this fails to find the object.

Any ideas?

Thanks for helping,

Alex

> -Original Message-
> From: Seb Bacon [mailto:[EMAIL PROTECTED]]
> Sent: Monday, November 06, 2000 8:50 PM
> To: Bowyer, Alex; [EMAIL PROTECTED]
> Subject: RE: [Zope] Help wanted on Zope ZClasses/DTML please.
> 
> 
> 
> > I have worked out thanks to Seb's comments that the problem I
> > have with the
> > use of manage_delObjects is (I think) that I am passing in 
> the title or id
> > of the object to be deleted rather than the object itself.
> 
> Not quite... manage_delObjects takes a string which is the id 
> of the object
> to be deleted.  Your example
> 
> 
> 
> was passing a string 'the_id' to the method.  I might have 
> interpreted what
> you were trying to do wrongly, but I believe you actually 
> wanted to pass the
> _value_ of the_id.
> 
> > I want to put the object into the REQUEST so I can still 
> access it from a
> > different namespace - at the point I want to do the 
> deletion, my target
> > object is out of scope.
> 
> In fact you just have to put the correct string into the 
> REQUEST and then
> make sure you have the object you're trying to reference in 
> your current
> namespace, e.g. by using  "manage_delObjects(the_id)">.  If you need more 
> help, post the
> snippet you're working on again.
> 
> seb.
> 

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




RE: [Zope] Help wanted on Zope ZClasses/DTML please.

2000-11-06 Thread Seb Bacon


> I have worked out thanks to Seb's comments that the problem I
> have with the
> use of manage_delObjects is (I think) that I am passing in the title or id
> of the object to be deleted rather than the object itself.

Not quite... manage_delObjects takes a string which is the id of the object
to be deleted.  Your example



was passing a string 'the_id' to the method.  I might have interpreted what
you were trying to do wrongly, but I believe you actually wanted to pass the
_value_ of the_id.

> I want to put the object into the REQUEST so I can still access it from a
> different namespace - at the point I want to do the deletion, my target
> object is out of scope.

In fact you just have to put the correct string into the REQUEST and then
make sure you have the object you're trying to reference in your current
namespace, e.g. by using .  If you need more help, post the
snippet you're working on again.

seb.


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




RE: [Zope] Help wanted on Zope ZClasses/DTML please.

2000-11-05 Thread Bowyer, Alex

Thanks to everyone who gave me tips in answer to my questions, I have one
further question.

I have worked out thanks to Seb's comments that the problem I have with the
use of manage_delObjects is (I think) that I am passing in the title or id
of the object to be deleted rather than the object itself.

I want to put the object into the REQUEST so I can still access it from a
different namespace - at the point I want to do the deletion, my target
object is out of scope.

How do you get a reference or pointer to the current object and put it into
the REQUEST for later use?

Thanks again,

Alex

==
Alex Bowyer
IT Contractor, Logica Australasia
Tel: +61 2 9202 8130
Fax: +61 2 9922 7466
E-mail : [EMAIL PROTECTED]
WWW: http://www.logica.com.au/
==


> -Original Message-
> From: Seb Bacon [mailto:[EMAIL PROTECTED]]
> Sent: Friday, November 03, 2000 8:08 PM
> To: Bowyer, Alex; [EMAIL PROTECTED]
> Subject: RE: [Zope] Help wanted on Zope ZClasses/DTML please.
> 
> 
> Hi, just some quick pointers (I'm in a hurry...)
> 
> refer to http://zdp.zope.org/projects/zqr/ZopeQR for more details
> 
> >   
> >   
> > What is the correct way to use manage_delObjects?
> 
>
> 
> should work.  What you wrote looks for an object with id 
> "the_id".  In fact
> you want the value of the_id, which is evaluated for you when 
> it's in quotes
> (think of everything in quotes as python).
> 
> > 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?
> 
>  gives you the parent
> 
> > 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
> > anyway.
> 
> window.location.reload() works 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.
> 
> you can attach permissions to specific methods in a ZClass by 
> mapping them
> to existing permissions in the 'define permissions' management tab.
> 
> cheers,
> 
> seb.
> 

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




Re: [Zope] Help wanted on Zope ZClasses/DTML please.

2000-11-03 Thread Andy McKay

or try: 

- Original Message -
From: "chip johansen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, November 03, 2000 9:01 AM
Subject: Re: [Zope] Help wanted on Zope ZClasses/DTML please.


> Instead of ...
>
>  "manage_delObjects('REQUEST['id_to_delete']')">
>
> try
>
>  "manage_delObjects('REQUEST.id_to_delete')">
>
> Chip Johansen
>
> >From: "Bowyer, Alex" <[EMAIL PROTECTED]>
> >To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> >Subject: [Zope] Help wanted on Zope ZClasses/DTML please.
> >Date: Fri, 3 Nov 2000 16:05:49 +1100
> >
> >Hi,
> >
> >I have only just started developing in Zope over this last week. I like
it
> >a
> >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.
> >-
> >Properties:
> >  article_title,article_author and article_text (self-explanatory)
> >DTML Methods:
> >  index_html - renders the data from the three properties into HTML ready
> >for
> >inclusion in the news page
> >  edit - a page with a form to allow you to modify the content, submits
to
> >"update"
> >  update - processes the form results from "edit", updates the properties
> >and
> >redirects
> >
> >UAPage : the page itself, inherits from ObjectManager and has Add
UAArticle
> >permission defined. Each instance contains 0 or more UAArticles.
> >--
> >Properties:
> >  issue_date, issue_number, intro_text (self-explanatory)
> >Methods:
> >  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
> >properties
> >and add a new article, or select an article to edit or delete.
> >  update - processes updates to the UAPage properties that have been made
> >on
> >the edit page.
> >  edit_article - once an article is selected and the Edit button is
> >clicked,
> >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
> >actually
> >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:
> >
> >
> >
> >
> >
> >
> >
> >
> >>UAArticleClassPropertySheet>
> >   
> > 
> > 
> >   
> >   
> >
> >
> >
> >   
> >   Article not found
> >   Could not find the article to delete.Return to
> >maintenance page
> >
> >   
> >   
> >   
> >   
> >   Article deleted
> >   Deleted article '&dtml-the_match;' (id='&dtml-the_id;'). >HREF=edit>Return to maintenance page
> >   
> >
> >
> >
> >
> >This gets an error that the_id does not exist. But I can't put  >"manage_delObjects('REQUEST['id_to_delete']')"> because that is quotes
> >within quotes within quotes. I also tried   >"manage_delObjects()"> 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 

Re: [Zope] Help wanted on Zope ZClasses/DTML please.

2000-11-03 Thread chip johansen

Instead of ...



try



Chip Johansen

>From: "Bowyer, Alex" <[EMAIL PROTECTED]>
>To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
>Subject: [Zope] Help wanted on Zope ZClasses/DTML please.
>Date: Fri, 3 Nov 2000 16:05:49 +1100
>
>Hi,
>
>I have only just started developing in Zope over this last week. I like it 
>a
>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.
>-
>Properties:
>  article_title,article_author and article_text (self-explanatory)
>DTML Methods:
>  index_html - renders the data from the three properties into HTML ready 
>for
>inclusion in the news page
>  edit - a page with a form to allow you to modify the content, submits to
>"update"
>  update - processes the form results from "edit", updates the properties 
>and
>redirects
>
>UAPage : the page itself, inherits from ObjectManager and has Add UAArticle
>permission defined. Each instance contains 0 or more UAArticles.
>--
>Properties:
>  issue_date, issue_number, intro_text (self-explanatory)
>Methods:
>  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 
>properties
>and add a new article, or select an article to edit or delete.
>  update - processes updates to the UAPage properties that have been made 
>on
>the edit page.
>  edit_article - once an article is selected and the Edit button is 
>clicked,
>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 
>actually
>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:
>
>
>
>
>
>
>
>
>   UAArticleClassPropertySheet>
>   
> 
> 
>   
>   
>
>
>
>   
>   Article not found
>   Could not find the article to delete.Return to
>maintenance page
>
>   
>   
>   
>   
>   Article deleted
>   Deleted article '&dtml-the_match;' (id='&dtml-the_id;').HREF=edit>Return to maintenance page
>   
>
>
>
>
>This gets an error that the_id does not exist. But I can't put "manage_delObjects('REQUEST['id_to_delete']')"> because that is quotes
>within quotes within quotes. I also tried  "manage_delObjects()"> 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 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
>anyway.
>
>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 
>areas.
>It just seems to cover the basics of ZClasses.
>
>Regards,
>
>Alex
>
>==
>Alex Bowyer
>IT Contractor, Logica Australasia
>Tel: +61 2 9202 8130
>Fax: +61 2 9922 7466
>E-mail : [EMAIL PROTECTED]
>WWW: http://www.logica.com.au/
>==
>
>___
>Zope maillist  -  [EMAIL PROTECTED]
>http://lists.zope.org/mailman/listinfo/zope
>**   No cross posts or HTML encoding!

RE: [Zope] Help wanted on Zope ZClasses/DTML please.

2000-11-03 Thread Seb Bacon

Hi, just some quick pointers (I'm in a hurry...)

refer to http://zdp.zope.org/projects/zqr/ZopeQR for more details

>   
>   
> What is the correct way to use manage_delObjects?

   

should work.  What you wrote looks for an object with id "the_id".  In fact
you want the value of the_id, which is evaluated for you when it's in quotes
(think of everything in quotes as python).

> 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?

 gives you the parent

> 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
> anyway.

window.location.reload() works 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.

you can attach permissions to specific methods in a ZClass by mapping them
to existing permissions in the 'define permissions' management tab.

cheers,

seb.


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