Error in checkout with sqlite

Issue #65 resolved
Former user created an issue

I'm working in this proyect and try a checkout with dummy procesor, using sqlite:

I execute the INSERT directly in sqlite and was ok, so the problem is in other place.

By the way, this error is outside the transaction so the cart get cleared.

I have Python 2.4 and last checkout of django.

InterfaceError at /checkout/dummy/confirm/ Error binding parameter 2 - probably unsupported type.

Exception Location: E:\Programacion\Python\Python24\lib\site-packages \django\db\backends\sqlite3\base.py in execute, line 101 Traceback (innermost last) Switch to copy-and-paste view

* E:\Proyectos\Python\Tienda\satchmo\..\satchmo\payment\modules

\dummy\views.py in confirm_info 3. from satchmo.payment.paymentsettings import PaymentSettings 4. from satchmo.payment.common.views import credit_confirm, credit_payship 5. 6. def pay_ship_info(request): 7. return credit_payship.pay_ship_info(request, PaymentSettings().DUMMY) 8. 9. def confirm_info(request): 10. return credit_confirm.confirm_info(request, PaymentSettings().DUMMY) ... 11. 12. * E:\Proyectos\Python\Tienda\satchmo..\satchmo\payment\common \views\credit_confirm.py in confirm_info 41. tempCart.empty() 42. #Update status 43. status = OrderStatus() 44. status.status = "Pending" 45. status.notes = _("Order successfully submitted") 46. status.timeStamp = datetime.datetime.now() 47. status.order = orderToProcess #For some reason auto_now_add wasn't working right in admin 48. status.save() ... 49. #Now, send a confirmation email 50. shop_config = Config.objects.get(site=settings.SITE_ID) 51. shop_email = shop_config.storeEmail 52. shop_name = shop_config.storeName 53. t = loader.get_template('email/order_complete.txt') 54. c = Context({'order': orderToProcess, \Proyectos\Python\Tienda\satchmo..\satchmo\payment\modules\dummy \processor.py'> msg 'Success' orderToProcess <Order: Mario Montoya> payment_module <satchmo.payment.paymentsettings._PaymentModule object at 0x02BFA810> processor <satchmo.payment.modules.dummy.processor.PaymentProcessor object at 0x03106AB0> reason_code '0' request

  results
  True
  status
  <OrderStatus: Pending>
  tempCart
  <Cart: Shopping Cart (2007-06-12 22:21:31.484000)>
* E:\Proyectos\Python\Tienda\satchmo\..\satchmo\contact\models.py

in save 403. notes = models.CharField(("Notes"), maxlength=100, blank=True) 404. timeStamp = models.DateTimeField(("Time Stamp")) 405. 406. def str(self): 407. return self.status 408. 409. def save(self): 410. super(OrderStatus, self).save() ... 411. self.order.status = self.status 412. self.order.save() 413. 414. class Meta: 415. verbose_name = ("Order Status") 416. verbose_name_plural = ("Order statuses") ▶ Local vars Variable Value self <OrderStatus: Pending> * E:\Programacion\Python\Python24\lib\site-packages\django\db \models\base.py in save 236. # TODO: This assumes the database supports subqueries. 237. placeholders.append('(SELECT COUNT(*) FROM %s WHERE %s = % %s)' % \ 238. (backend.quote_name(self._meta.db_table), backend.quote_name(self._meta.order_with_respect_to.column))) 239. db_values.append(getattr(self, self._meta.order_with_respect_to.attname)) 240. if db_values: 241. cursor.execute("INSERT INTO %s (%s) VALUES (%s)" % \ 242. (backend.quote_name(self._meta.db_table), ','.join(field_names), 243. ','.join(placeholders)), db_values) ... 244. else: 245. # Create a new record with defaults for everything. 246. cursor.execute("INSERT INTO %s (%s) VALUES (%s)" % 247. (backend.quote_name(self._meta.db_table), 248. backend.quote_name(self._meta.pk.column), 249. backend.get_pk_default_value())) ▶ Local vars Variable Value cursor <django.db.backends.util.CursorDebugWrapper object at 0x03133770> db_values [1, 'Pending', 'Order successfully submitted', '2007-06-13 17:58:12.718000'] f <django.db.models.fields.DateTimeField object at 0x02B99C70> field_names ['"order_id"', '"status"', '"notes"', '"timeStamp"'] non_pks [<django.db.models.fields.related.ForeignKey object at 0x02B93E10>, <django.db.models.fields.CharField object at 0x02B93EF0>, <django.db.models.fields.CharField object at 0x02B93F30>, <django.db.models.fields.DateTimeField object at 0x02B99C70>] pk_set False pk_val None placeholders ['%s', '%s', '%s', '%s'] record_exists True self <OrderStatus: Pending> * E:\Programacion\Python\Python24\lib\site-packages\django\db \backends\util.py in execute 10. def init(self, cursor, db): 11. self.cursor = cursor 12. self.db = db 13. 14. def execute(self, sql, params=()): 15. start = time() 16. try: 17. return self.cursor.execute(sql, params) ... 18. finally: 19. stop = time() 20. # If params was a list, convert it to a tuple, because string 21. # formatting with '%' only works with tuples or dicts. 22. if not isinstance(params, (tuple, dict)): 23. params = tuple(params) ▶ Local vars Variable Value params (1, 'Pending', 'Order successfully submitted', '2007-06-13 17:58:12.718000') self <django.db.backends.util.CursorDebugWrapper object at 0x03133770> sql 'INSERT INTO "contact_orderstatus" ("order_id","status","notes","timeStamp") VALUES (%s,%s,%s,%s)' start 1181775492.7179999 stop 1181775492.7179999 * E:\Programacion\Python\Python24\lib\site-packages\django\db \backends\sqlite3\base.py in execute 94. """ 95. Django uses "format" style placeholders, but pysqlite2 uses "qmark" style. 96. This fixes it -- but note that if you want to use a literal "%s" in a query, 97. you'll need to use "%%s". 98. """ 99. def execute(self, query, params=()): 100. query = self.convert_query(query, len(params)) 101. return Database.Cursor.execute(self, query, params) ... 102. 103. def executemany(self, query, param_list): 104. query = self.convert_query(query, len(param_list[0])) 105. return Database.Cursor.executemany(self, query, param_list) 106. 107. def convert_query(self, query, num_params

Reported by mamcx

Comments (2)

  1. Log in to comment