GIDForums  

Go Back   GIDForums > Computer Programming Forums > Python Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 09-May-2006, 05:45
DeZ DeZ is offline
New Member
 
Join Date: Apr 2006
Posts: 4
DeZ is on a distinguished road

using databases and cookies


I have some trouble using databases (pysqlite) and how to implement it. oh and also how do i use cookies??

here is the code that im working on

Python Code:
"""Cart page handler for COMP249 Store"""

import cgi
import page
import Cookie import SimpleCookie
import os

def handle(form):
    """Output the cart page"""
    
    content = """
<p>This will be the shopping cart page.</p>
"""    
    if form.has_key("prod"):
        content += "<p>You have selected a "+form.getvalue("prod")+".</p>"
    html = page.html({
        'id': 'cart',
        'title':  "COMP249 Store",
        'content' : content
        })
    header = "Content-Type: text/html\n\n"
    return header + html



# define the contents procedure used by the page generation module
def contents():
    """Generate a list of cart contents for the sidebar"""
    return "<h2>Your Shopping Cart</h2> <p>Your cart is empty</p>"

im trying to add items to the 'cart' like an online shopping website. Can anybody help me with this?? thanx a lot!
  #2  
Old 09-May-2006, 13:28
crystalattice's Avatar
crystalattice crystalattice is offline
Aspiring author
 
Join Date: Apr 2004
Location: Japan (again)
Posts: 1,635
crystalattice is just really nicecrystalattice is just really nicecrystalattice is just really nicecrystalattice is just really nicecrystalattice is just really nice

Re: using databases and cookies


While I haven't started to work w/ DB's and Python yet, here's a couple of things to try. HotScripts has some Python database scripts that might help you out. You might want to look at Django and TurboGears, as they are web-development "suites" and should help you immensely.

Regarding cookies, Python docs discusses the cookie module, the author of Voidspace created a cookie library module, and there's a project on Sourceforge for cookies in Python.
__________________
Start Programming with Python-A beginner's guide to programming and the Python language.
-------------
Common Sense v2.0-Striving to make the world a little bit smarter.
 
 

Recent GIDBlogNot selected for officer school by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 03:12.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.