- if hasattr(v, 'items') :
- uid, templateId = k.split('_',1)
- if v.has_key('refresh') :
- quantity = v['quantity']
- try :
- quantity = int(quantity)
- except ValueError:
- msg = _('You must enter an integer for quantity (found: %s)') % quantity
- if quantity <= 0 :
- msg = _('You must enter a positive value for quantity (found: %s)') % quantity
- if not msg :
- item = {'cmf_uid' : uid
- ,'printing_template' : templateId
- ,'quantity' : quantity}
- try :
- cart.update(context, item)
- except SoldOutError, e :
- n = e.n
- if n > 1 :
- msg = _("Only %d available copies of this photo in this size.") % n
- elif n == 1 :
- msg = _("Only one last available copy of this photo in this size.")
- else :
- msg = _("No more available copy of this photo and in this size.")
-
-
- if v.has_key('delete'):
- cart.remove(context, uid, templateId)
+ if hasattr(v, 'items') :
+ uid, templateId = k.split('_',1)
+ if v.has_key('refresh') :
+ quantity = v['quantity']
+ try :
+ quantity = int(quantity)
+ except ValueError:
+ msg = _('You must enter an integer for quantity (found: %s)') % quantity
+ if quantity <= 0 :
+ msg = _('You must enter a positive value for quantity (found: %s)') % quantity
+ if not msg :
+ item = {'cmf_uid' : uid
+ ,'printing_template' : templateId
+ ,'quantity' : quantity}
+ try :
+ cart.update(context, item)
+ except SoldOutError, e :
+ n = e.n
+ if n > 1 :
+ msg = _("Only %d available copies of this photo in this size.") % n
+ elif n == 1 :
+ msg = _("Only one last available copy of this photo in this size.")
+ else :
+ msg = _("No more available copy of this photo and in this size.")
+
+
+ if v.has_key('delete'):
+ cart.remove(context, uid, templateId)