Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 30th, 2004, 02:22 AM
Konstandinos Konstandinos is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: Cape Town, South Africa
Posts: 131 Konstandinos User rank is Corporal (100 - 500 Reputation Level)Konstandinos User rank is Corporal (100 - 500 Reputation Level)Konstandinos User rank is Corporal (100 - 500 Reputation Level)Konstandinos User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 22 h 40 m 25 sec
Reputation Power: 7
Question Session management with quixote.

Hey peeps

Hoping for a general discussion type response to this thread.

I'm looking for information on handling sessions within the quixote framework.

For example: having constructed a form with various checkboxes and so forth, I am able to submit this form with a submitButton widget. Now say I want some more buttons/links that take me to another form page (with some generated tables retrieved via sql) with different funcionality (as opposed to a standard submit) - ie: "create new page/form and do this also" - (whereas a standard submit would just imply "create new page with this data available") - how would I do this?

From what I can tell, I would need sessions for this, so I'm looking for any helpful info on managing them in quixote.

Even if my assumption is incorrect, and I don't need sessions, I still have to implement session functionality as part of the project. So although alternative (and possibly superior) suggestions would be greatly appreciated, I'm still hoping for feedback on quixote sessions.

Cheers,
Kosta

(edited)

ps: say I have a standard html a href link tag, that I use to link to myform.ptl in the same folder - it would basically look like:

Code:
<a href="myform">Go to my form</a>


Now I need to be able to click on that link to go to that form AND send any relevant data along with it.

From what I understand in quixote, you can either render a form or process it, depending on whether its just been opened or is being submitted. I basically want to be able to "open a form for first time viewing" and be able to give it default data to populate its tables with.

From what I can tell this isn't as easy as it sounds.

I'm hoping I'm missing something neat and simple.

Last edited by Konstandinos : November 30th, 2004 at 03:02 AM. Reason: Added comment on linking to ptl files.

Reply With Quote
  #2  
Old December 2nd, 2004, 09:37 AM
Konstandinos Konstandinos is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: Cape Town, South Africa
Posts: 131 Konstandinos User rank is Corporal (100 - 500 Reputation Level)Konstandinos User rank is Corporal (100 - 500 Reputation Level)Konstandinos User rank is Corporal (100 - 500 Reputation Level)Konstandinos User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 22 h 40 m 25 sec
Reputation Power: 7
Solution found.

Howdy,

For those of you who stumble accross this thread with the same question I had in the first post: I've found a solution.

Basically you use quixote's _q_lookup method to map dynamic URL's to objets (which you've defined in your quixote framework folder). The methods in these objects don't need to be exported - and as far as dynamic links go, all that happens is that _q_lookup(request, value) calls the object class, passes it the value (which is basically the end of the url string) and calls the respective method that you've defined to handle that particular value.

You can also implement checks to allow one to call different methods depending on the value's data, type, range etc.

Very useful indeed!

You're wondering what the use of all this is?

Well say you needed to link to a page called "EditStats" and based on the user that's logged in, say Bobby, you need to call "EditStats/Bobby". Now, Bobby is dynamic, therefore there is no way of having a static method called Bobby in your EditStats object (.py script). So you basically have a generic method (ie: dispDetails) which is called from the _q_lookup method, and the value Bobby is passed to it.

This would allow one to have a dynamic link:

Code:
user = getUser() #returns "Bobby"
"""
...
<a href="EditStats/%s">Edit stats</a>
...
""" % (user)


This link is therefore generated on the fly, depending on the user, and when you click on it, quixote first maps "EditStats" to your EditStats object, and then looks for the "Bobby" method. Since this method doesn't exist, it then calls _q_lookup(request, value) which in turn calls the generic method dispDetails(value) that renders your page for editing Bobby's data.

Nifty?

I sure as hell think so.

Hope this helps peeps with their quixote.

Cheers,
K

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Session management with quixote.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT