Commits

Anonymous committed 26f8bb8

0.13dev: Merged from 0.12-stable, including fixes for API changes in unit tests

  • Participants
  • Parent commits e88c431
  • Branches trunk

Comments (0)

Files changed (4)

File trac/attachment.py

            (will be removed in version 0.14)
         """
         self.size = int(size) if size else 0
+        self.filename = None
         if t is None:
             t = datetime.now(utc)
         elif not isinstance(t, datetime): # Compatibility with 0.11
         if not filename:
             raise TracError(_('No file uploaded'))
         # Now the filename is known, update the attachment resource
-        # attachment.filename = filename
+        attachment.filename = filename
         attachment.description = req.args.get('description', '')
         attachment.author = get_reporter_id(req, 'author')
         attachment.ipnr = req.remote_addr
                 old_attachment.delete()
             except TracError:
                 pass # don't worry if there's nothing to replace
-            attachment.filename = None
         attachment.insert(filename, upload.file, size)
 
         req.redirect(get_resource_url(self.env, attachment.resource(id=None),

File trac/db/mysql_backend.py

         self._is_closed = False
 
     def cast(self, column, type):
-        if type == 'int'or type == 'int64':
+        if type == 'int' or type == 'int64':
             type = 'signed'
         elif type == 'text':
             type = 'char'

File trac/web/session.py

             db("""
                 DELETE FROM session_attribute
                 WHERE authenticated=0
-                      AND sid IN (SELECT sid FROM session
-                                  WHERE authenticated=0 AND last_visit<%s)
-                """, (ts,))
+                      AND sid NOT IN (SELECT sid FROM session
+                                      WHERE authenticated=0)
+                """)

File trac/web/tests/session.py

         sess_admin._do_purge('2010-01-02')
         result = [i for i in sess_admin._get_list(['*'])]
         self.assertEqual(result, auth_list + anon_list)
+        result = get_session_info(self.env, anon_list[0][0])
+        self.assertEqual(result, ('name10', 'val10', 'val10'))
+        result = get_session_info(self.env, anon_list[1][0])
+        self.assertEqual(result, ('name11', 'val11', 'val11'))
 
         auth_list, anon_list, all_list = \
             _prep_session_table(self.env, spread_visits=True)
         sess_admin._do_purge('2010-01-12')
         result = [i for i in sess_admin._get_list(['*'])]
         self.assertEqual(result, auth_list + anon_list[1:])
+        rows = self.env.db_query("""
+            SELECT name, value FROM session_attribute WHERE sid = %s
+            """, (anon_list[0][0],))
+        self.assertEqual([], rows)
+        result = get_session_info(self.env, anon_list[1][0])
+        self.assertEqual(result, ('name11', 'val11', 'val11'))
 
 
 def suite():