LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File trac-discussion-plugin.no-ifelse-api-01.patch of Package trac-discussion-plugin (Project home:guidod:trac12)

--- 0.11/tracdiscussion/api.py.orig	2011-08-18 20:19:09.000000000 +0200
+++ 0.11/tracdiscussion/api.py	2011-08-18 20:46:25.000000000 +0200
@@ -1120 +1120 @@
-                    value = 1 if value in ('true', 'yes', True) else 0;
+                    value = (value in ('true', 'yes', True) and 1 or 0);
@@ -1511 +1511 @@
-          'where' : 'WHERE ' + where if where else ''}
+          'where' : (where and ('WHERE ' + where) or '')}
@@ -1664 +1664 @@
-          'where' : 'WHERE ' + where if where else ''}
+          'where' : (where and ('WHERE ' + where) or '')}
@@ -1688,5 +1688,4 @@
-          'where' : 'WHERE ' + where if where else '',
-          'order_by' : 'ORDER BY ' + order_by + (' ASC', ' DESC')[bool(desc)]
-            if order_by else '',
-          'limit' : 'LIMIT ' + to_unicode(limit) if limit else '',
-          'offset' : ' OFFSET ' + to_unicode(offset) if offset else ''}
+          'where' : (where and ('WHERE ' + where) or ''),
+          'order_by' : (order_by and ('ORDER BY ' + order_by + (' ASC', ' DESC')[bool(desc)]) or ''),
+          'limit' : (limit and ('LIMIT ' + to_unicode(limit)) or ''),
+          'offset' : (offset and (' OFFSET ' + to_unicode(offset)) or '')}
@@ -1724,2 +1723,2 @@
-        sql_values = {'order_by' : 'ORDER BY ' + order_by +
-          (' ASC', ' DESC')[bool(desc)] if order_by else ''}
+        sql_values = {'order_by' : (order_by and ('ORDER BY ' + order_by +
+          (' ASC', ' DESC')[bool(desc)]) or '')}
@@ -1792,2 +1791,2 @@
-        sql_values = {'order_by' : ('ORDER BY ' + order_by + (' ASC',
-          ' DESC')[bool(desc)]) if order_by else ''}
+        sql_values = {'order_by' : (order_by and ('ORDER BY ' + order_by + (' ASC',
+          ' DESC')[bool(desc)]) or '')}
@@ -1853,2 +1852,2 @@
-        sql_values = {'order_by' : ('ORDER BY ' + order_by + (' ASC', ' DESC')
-          [bool(desc)]) if order_by else ''}
+        sql_values = {'order_by' : (order_by and ('ORDER BY ' + order_by + (' ASC', ' DESC')
+          [bool(desc)]) and '')}
@@ -1894,5 +1893,5 @@
-        sql_values = {'with_body' : 't.body, ' if with_body else '',
-          'order_by' : 'ORDER BY priority DESC' + (", " + order_by + (' ASC',
-          ' DESC')[bool(desc)]) if order_by else '',
-          'limit' : 'LIMIT %s' if limit else '',
-          'offset' : 'OFFSET %s' if offset else ''}
+        sql_values = {'with_body' : (with_body and 't.body, ' or ''),
+          'order_by' : (order_by and ('ORDER BY priority DESC' + (", " + order_by + (' ASC',
+          ' DESC')[bool(desc)])) or ''),
+          'limit' : (limit and 'LIMIT %s' or ''),
+          'offset' : (offset and 'OFFSET %s' or '')}
@@ -1949,2 +1948,2 @@
-        sql_values = {'order_by' : ('ORDER BY ' + order_by + (' ASC', ' DESC')
-          [bool(desc)]) if order_by else ''}
+        sql_values = {'order_by' : (order_by and ('ORDER BY ' + order_by + (' ASC', ' DESC')
+          [bool(desc)]) and '')}
@@ -1972,2 +1971,2 @@
-          'order_by' : 'ORDER BY ' + order_by + (' ASC',' DESC')[bool(desc)]
-            if order_by else ''}
+          'order_by' : (order_by and ('ORDER BY ' + order_by + (' ASC',' DESC')[bool(desc)]
+            ) or '')}
@@ -2017,2 +2016,2 @@
-        sql_values = {'order_by' : ('ORDER BY ' + order_by + (' ASC', ' DESC')
-          [bool(desc)]) if order_by else ''}
+        sql_values = {'order_by' : (order_by and ('ORDER BY ' + order_by + (' ASC', ' DESC')
+          [bool(desc)]) or '')}
@@ -2087,2 +2086,2 @@
-        tmp_topic['status'] = self._topic_status_from_list(tmp_topic['status']
-          if tmp_topic.has_key('status') else [])
+        tmp_topic['status'] = self._topic_status_from_list(
+          tmp_topic.has_key('status') and tmp_topic['status'] or [])
@@ -2099 +2098 @@
-          'where' : ' WHERE ' + where if where else ''}
+          'where' : (where and (' WHERE ' + where) or '')}
@@ -2143 +2142 @@
-          'where' : 'WHERE ' + where if where else ''}
+          'where' : (where and ('WHERE ' + where) and '')}