shopcart-legacy-py2
PythonDemo Projecthttps://github.com/combcode/demo-shopcart ยท generated 10/1/2026
Files analyzed
42
Lines analyzed
6318
Components
12
Engine
CombCode Core Parser v2.5
Click to explore interactive visualization maps and step-by-step developer blueprints.
Overview
A Python 2.7 e-commerce storefront built on web.py and raw MySQLdb. It serves the product catalog, manages session-based carts, computes tax and shipping, and charges cards through a deprecated payment gateway SDK. A cron script reconciles orders with the warehouse CSV feed every night.
What it does
Lists ~3,200 products, holds carts in server-side pickled sessions, applies coupon and tiered-discount rules, then posts orders to the payment gateway and emails a receipt via smtplib.
Entry points
app.py maps URL routes to handler classes (Index, Product, Cart, Checkout, Admin). cron/reconcile.py runs at 02:00 and admin/import_csv.py is run manually by staff.
Data layer
db.py opens a global MySQLdb connection shared across requests. SQL is built with string formatting in models/order.py and models/product.py, creating SQL-injection risk on the search endpoint.
Hidden business rules
Free shipping over $75 except for Alaska/Hawaii, hard-coded in shipping.py; coupon 'LOYAL10' is applied silently for customers with more than 5 orders; tax rates for 4 states live in a dict literal.
Risk & security vectors
A payment gateway API key is hardcoded in settings.py. The cart session update is not locked, so two simultaneous requests can double-apply a coupon (race condition).
Python 2 blockers
print statements, dict.iteritems(), unicode/str mixing in templates, and the unmaintained web.py 0.37 framework all block a direct move to Python 3.