Edgewall Software
Modify

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#12446 closed enhancement (fixed)

Add as_int and as_bool methods to the DetachedSession class

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.2
Component: web frontend Version:
Severity: normal Keywords: session
Cc: Branch:
Release Notes:
API Changes:

Added as_bool and as_int methods to the DetachedSession class.

Internal Changes:

Description

Similar to #12426, I propose adding as_int and as_bool to the DetachedSession class.

Attachments (0)

Change History (5)

comment:1 by Ryan J Ollos, 8 years ago

API Changes: modified (diff)
Owner: set to Ryan J Ollos
Status: newassigned

comment:2 by Ryan J Ollos, 8 years ago

Resolution: fixed
Status: assignedclosed

Committed to trunk in [14707].

comment:3 by Jun Omae, 8 years ago

2 failures in https://travis-ci.org/edgewall/trac/builds/122104248.

======================================================================
ERROR: test_as_bool (trac.web.tests.session.SessionTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/edgewall/trac/trac/web/tests/session.py", line 214, in test_as_bool
    """)
  File "/home/travis/build/edgewall/trac/trac/db/util.py", line 128, in execute
    cursor.execute(query, params if params is not None else [])
  File "/home/travis/build/edgewall/trac/trac/db/util.py", line 63, in execute
    r = self.cursor.execute(sql)
  File "/home/travis/build/edgewall/trac/trac/db/sqlite_backend.py", line 87, in execute
    result = PyFormatCursor.execute(self, *args)
  File "/home/travis/build/edgewall/trac/trac/db/sqlite_backend.py", line 63, in execute
    args or [])
  File "/home/travis/build/edgewall/trac/trac/db/sqlite_backend.py", line 54, in _rollback_on_error
    return function(self, *args, **kwargs)
OperationalError: near ",": syntax error

======================================================================
ERROR: test_as_int (trac.web.tests.session.SessionTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/edgewall/trac/trac/web/tests/session.py", line 195, in test_as_int
    """)
  File "/home/travis/build/edgewall/trac/trac/db/util.py", line 128, in execute
    cursor.execute(query, params if params is not None else [])
  File "/home/travis/build/edgewall/trac/trac/db/util.py", line 63, in execute
    r = self.cursor.execute(sql)
  File "/home/travis/build/edgewall/trac/trac/db/sqlite_backend.py", line 87, in execute
    result = PyFormatCursor.execute(self, *args)
  File "/home/travis/build/edgewall/trac/trac/db/sqlite_backend.py", line 63, in execute
    args or [])
  File "/home/travis/build/edgewall/trac/trac/db/sqlite_backend.py", line 54, in _rollback_on_error
    return function(self, *args, **kwargs)
OperationalError: near ",": syntax error

Multi-values insert is available since sqlite 3.7.11. SQLite on Travis CI is 3.7.9.

207     def test_as_bool(self):
208         with self.env.db_transaction as db:
209             db("INSERT INTO session VALUES ('123456', 1, 0)")
210             db("""
211                 INSERT INTO session_attribute VALUES
212                 ('123456', 1, 'foo', 'bar'),
213                 ('123456', 1, 'baz', 1)
214                 """)
215
  sqlite3      : 2.4.1 (3.7.9)

comment:4 by Ryan J Ollos, 8 years ago

Thanks, I spotted while working on #12448. Fixed in [14711].

Last edited 8 years ago by Ryan J Ollos (previous) (diff)

comment:5 by Ryan J Ollos, 8 years ago

#12561 is due to changes in this ticket.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.