diff --git a/tailbone/views/products.py b/tailbone/views/products.py index 92a32990..7c25fa4d 100644 --- a/tailbone/views/products.py +++ b/tailbone/views/products.py @@ -20,7 +20,6 @@ # along with Rattail. If not, see . # ################################################################################ - """ Product Views """ @@ -28,6 +27,7 @@ Product Views from __future__ import unicode_literals import os +import re from sqlalchemy import and_ from sqlalchemy.orm import joinedload, aliased @@ -295,9 +295,9 @@ def products_search(request): Eventually this should be more generic, or at least offer more fields for search. For now it operates only on the ``Product.upc`` field. """ - product = None - upc = request.GET.get('upc') + upc = request.GET.get('upc', '').strip() + upc = re.sub(r'\D', '', upc) if upc: product = get_product_by_upc(Session, upc) if not product: