Permalink
Browse files

Make reddit compatible with Postgres 8.3 and Python 2.6

  • Loading branch information...
1 parent 2a280ed commit 9813d94741cfff8c16d2326d9c7110ce61f820b7 @jedberg jedberg committed Apr 29, 2009
Showing with 10 additions and 14 deletions.
  1. +1 −0 r2/example.ini
  2. +1 −0 r2/r2/lib/app_globals.py
  3. +3 −4 r2/r2/lib/c/filters.c
  4. +3 −8 r2/r2/lib/db/tdb_sql.py
  5. +2 −2 r2/r2/public/static/css/reddit.css
View
@@ -8,6 +8,7 @@ debug = true
template_debug = true
uncompressedJS = true
translator = true
+sqlprinting = false
proxy_addr =
log_path =
View
@@ -49,6 +49,7 @@ class Globals(object):
]
bool_props = ['debug', 'translator',
+ 'sqlprinting',
'template_debug',
'uncompressedJS',
'enable_doquery',
View
@@ -235,16 +235,15 @@ filters_uspace_compress(PyObject * self, PyObject *args) {
c = command[ic];
if(gobble) {
if(Py_UNICODE_ISSPACE(c)) {
- while(Py_UNICODE_ISSPACE(command[++ic]));
- c = command[ic];
+ while(Py_UNICODE_ISSPACE(c)) { c = command[++ic]; }
if(c != (Py_UNICODE)('<')) {
buffer[ib++] = (Py_UNICODE)(' ');
}
}
if(c == (Py_UNICODE)('>')) {
buffer[ib++] = c;
- while(Py_UNICODE_ISSPACE(command[++ic]));
- c = command[ic];
+ c = command[++ic];
+ while(Py_UNICODE_ISSPACE(c)) { c = command[++ic]; }
}
if (len - ic >= MD_START_LEN &&
memcmp(&command[ic], MD_START_U,
View
@@ -44,7 +44,7 @@
def make_metadata(engine):
metadata = sa.MetaData(engine)
- metadata.bind.echo = g.debug
+ metadata.bind.echo = g.sqlprinting
return metadata
def create_table(table, index_commands=None):
@@ -582,12 +582,6 @@ def del_rel(rel_type_id, rel_id):
table.delete(table.c.rel_id == rel_id).execute()
data_table.delete(data_table.c.thing_id == rel_id).execute()
-def sa_rval_op(rval):
- if isinstance(rval, operators.rval_op):
- return getattr(sa.func, rval.__class__.__name__)(rval.rval)
- else:
- return rval
-
def sa_op(op):
#if BooleanOp
if isinstance(op, operators.or_):
@@ -727,7 +721,8 @@ def translate_data_value(alias, op):
op.lval = lval
#convert the rval to db types
- op.rval = tuple(py2db(v) for v in tup(op.rval))
+ #convert everything to strings for pg8.3
+ op.rval = tuple(str(py2db(v)) for v in tup(op.rval))
#TODO sort by data fields
#TODO sort by id wants thing_id
@@ -765,7 +765,7 @@ a.star { text-decoration: none; color: #ff8b60 }
.linkcompressed .score.likes { color: #FF8B60; }
.linkcompressed .score.dislikes { color: #9494FF; }
.linkcompressed .rank {
- margin-top: 3px;
+ margin-top: 4px;
float:left;
color: #c6c6c6;
font-family: arial;
@@ -780,7 +780,7 @@ a.star { text-decoration: none; color: #ff8b60 }
.linkcompressed .entry .buttons li.first {padding-left: .5em;}
.linkcompressed .entry .buttons li a {
padding: 0 2px;
- background-color: #f2f2f2;
+ background-color: #f3f3f3;
font-weight: bold
}

0 comments on commit 9813d94

Please sign in to comment.