#NEWLINE# def delete( self , table , **kw ) : #NEWLINE# #INDENT# 'SQL delete statement helper.\n\n        Mandatory positional arguments:\n        cursor -- the cursor\n        table -- name of the table\n\n        Optional keyword arguments:\n        where -- AND-joined where clause dict (default empty)\n        where_or -- OR-joined where clause dict (default empty)\n        tighten_sequence -- if True, will decrement the pkey sequence when deleting the latest row,\n                            and has no effect otherwise (default False)\n        debug_print -- print query before executing it (default False)\n        debug_assert -- throw assert exception (showing query), without executing it;\n                        useful for web dev debugging (default False)\n\n        ' #NEWLINE# _check_args ( 'delete' , kw . keys ( ) , ( 'where' , 'where_or' , 'tighten_sequence' , 'debug_print' , 'debug_assert' ) ) #NEWLINE# where = kw . pop ( 'where' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# where_or = kw . pop ( 'where_or' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# q = ( 'delete from %s' % table ) #NEWLINE# if where : #NEWLINE# #INDENT# where_clause = _get_where_clause ( where . items ( ) ) #NEWLINE# q += ( ' where %s' % where_clause ) #NEWLINE# #UNINDENT# if where_or : #NEWLINE# #INDENT# where_or_clause = _get_where_clause ( where_or . items ( ) , 'or' ) #NEWLINE# if where_or : #NEWLINE# #INDENT# q += ( ' and (%s)' % where_or_clause ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# q += ( ' where %s' % where_or_clause ) #NEWLINE# #UNINDENT# #UNINDENT# ts_vals = [ ] #NEWLINE# if kw . pop ( 'tighten_sequence' , False ) : #NEWLINE# #INDENT# pkey = self . get_table_infos ( table ) . pkey #NEWLINE# q += ( '; select setval(%%s, coalesce((select max(%s) + 1 from %s), 1), false)' % ( pkey , table ) ) #NEWLINE# ts_vals = [ self . get_pkey_sequence ( table ) ] #NEWLINE# #UNINDENT# self . _exec_query ( q , ( ( list ( where . values ( ) ) + list ( where_or . values ( ) ) ) + ts_vals ) , ** kw )