[Radiant] Redirect hell

2006-09-01 Thread Sean Cribbs
John et al,I think I'm in the final step of creating my Commentable/CommentBucket behaviors before releasing them into the wild, but I've found that I'm getting into an endless redirect loop after most of my process method finishes (I want to potentially redirect back to the same page, but without the post). How can I avoid this endless loop? I tried nullifying the request and response objects. Is the redirect itself getting cached?
Sean Cribbsseancribbs.com
___
Radiant mailing list
Radiant@lists.radiantcms.org
http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] Redirect hell

2006-09-01 Thread John W. Long
Sean Cribbs wrote:
 John et al,
 
 I think I'm in the final step of creating my Commentable/CommentBucket
 behaviors before releasing them into the wild, but I've found that I'm
 getting into an endless redirect loop after most of my process method
 finishes (I want to potentially redirect back to the same page, but without
 the post).  How can I avoid this endless loop? I tried nullifying the
 request and response objects. Is the redirect itself getting cached?

You should definately turn caching off:

   def cache_page?
 false
   end

When working with forms on pages, I like to use request.post? to check 
process a posted form. Here's and excerpt from a behavior I wrote for 
Ruby-Lang.org:

   def render_page
 if request.post?
   @list   = List.lookup(params[:list] || 'ruby-talk')
   @first_name = get_param(:first_name)
   @last_name  = get_param(:last_name)
   @email  = get_param(:email)
   @action = get_param(:action).downcase
   ...
   @success = true
 else
   @success = false
 end
 super
   end

--
John Long
http://wiseheartdesign.com
___
Radiant mailing list
Radiant@lists.radiantcms.org
http://lists.radiantcms.org/mailman/listinfo/radiant


Re: [Radiant] Redirect hell

2006-09-01 Thread Sean Cribbs
Sorry, I don't mean to spam the list, but my second method worked. Rock on!Sean Cribbsseancribbs.comOn 9/1/06, 
Sean Cribbs [EMAIL PROTECTED] wrote:
Thanks, John.I guess I'll have to settle for not caching the page. I wanted to be able to cache the page that displayed the comments (Commentable behavior), but have it create the child page (CommentBucket behavior, whose children are individual comments) if it doesn't exist, and then only cache when it exists. Is there no way to clear the cache for that page after the redirect occurs?
Alternatively, I'm thinking that I'm going to try redirecting to the CommentBucket page (which already redirects back to the Commentable and is uncached), and have it clear the cache before its redirect. Kind of a hack, but it just might work.
Sean Cribbsseancribbs.com
On 9/1/06, John W. Long [EMAIL PROTECTED]
 wrote:Sean Cribbs wrote: John et al, I think I'm in the final step of creating my Commentable/CommentBucket
 behaviors before releasing them into the wild, but I've found that I'm getting into an endless redirect loop after most of my process method finishes (I want to potentially redirect back to the same page, but without
 the post).How can I avoid this endless loop? I tried nullifying the request and response objects. Is the redirect itself getting cached?You should definately turn caching off: def cache_page?
 false endWhen working with forms on pages, I like to use request.post? to checkprocess a posted form. Here's and excerpt from a behavior I wrote forRuby-Lang.org: def render_page

 if request.post? @list = List.lookup(params[:list] || 'ruby-talk') @first_name = get_param(:first_name) @last_name= get_param(:last_name) @email= get_param(:email)
 @action = get_param(:action).downcase ... @success = true else @success = false end super end--John Long

http://wiseheartdesign.com___Radiant mailing list
Radiant@lists.radiantcms.org
http://lists.radiantcms.org/mailman/listinfo/radiant


___
Radiant mailing list
Radiant@lists.radiantcms.org
http://lists.radiantcms.org/mailman/listinfo/radiant