fixed issue 728, bug in languages, thanks pgergo

This commit is contained in:
Massimo Di Pierro
2012-03-26 11:17:20 -05:00
parent bc4def632c
commit ba93692ed4
84 changed files with 222 additions and 137 deletions
+1 -1
View File
@@ -1 +1 @@
Version 1.99.7 (2012-03-26 11:13:57) dev
Version 1.99.7 (2012-03-26 11:17:03) dev
+2
View File
@@ -2,3 +2,5 @@
+1
View File
@@ -299,3 +299,4 @@ if __name__=='__main__':
main()
+1
View File
@@ -4,3 +4,4 @@ def webapp_add_wsgi_middleware(app):
return app
+1
View File
@@ -63,3 +63,4 @@ import gluon.main
wsgiref.handlers.CGIHandler().run(gluon.main.wsgibase)
+1
View File
@@ -53,3 +53,4 @@ if SOFTCRON:
fcgi.WSGIServer(application, bindAddress='/tmp/fcgi.sock').run()
+1
View File
@@ -101,3 +101,4 @@ if __name__ == '__main__':
main()
+2
View File
@@ -36,3 +36,5 @@ if 0:
+1
View File
@@ -458,3 +458,4 @@ def create_missing_app_folders(request):
+2 -1
View File
@@ -372,7 +372,7 @@ class Cache(object):
the global request object
"""
# GAE will have a special caching
if have_settings and settings.global_settings.web2py_runtime_gae:
from contrib.gae_memcache import MemcacheClient
self.ram=self.disk=MemcacheClient(request)
@@ -438,3 +438,4 @@ class Cache(object):
+1
View File
@@ -52,3 +52,4 @@ def getcfs(key, filename, filter=None):
+2 -1
View File
@@ -111,7 +111,7 @@ def LOAD(c=None, f='index', args=None, vars=None,
url=None,user_signature=False, timeout=None, times=1,
content='loading...',**attr):
""" LOAD a component into the action's document
Timing options:
-times: An integer or string ("infinity"/"continuous")
specifies how many times the component is requested
@@ -692,3 +692,4 @@ if __name__ == '__main__':
+1
View File
@@ -721,3 +721,4 @@ def contenttype(filename, default='text/plain'):
+1
View File
@@ -261,3 +261,4 @@ if __name__=='__main__':
+1
View File
@@ -241,3 +241,4 @@ if __name__=='__main__':
+1
View File
@@ -3,3 +3,4 @@
+1
View File
@@ -192,3 +192,4 @@ if __name__ == "__main__":
+1
View File
@@ -3908,3 +3908,4 @@ def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, refer
+1
View File
@@ -53,3 +53,4 @@ class MemcacheClient(Client):
+1
View File
@@ -88,3 +88,4 @@ def autoretry_datastore_timeouts(attempts=5.0, interval=0.1, exponent=2.0):
+1
View File
@@ -65,3 +65,4 @@ def pdf_from_html(html):
+1
View File
@@ -17,3 +17,4 @@ def button(merchant_id="123456789012345",
+1
View File
@@ -7,3 +7,4 @@ from gluon.dal import DAL, Field, Table, Query, Set, Expression, Row, Rows, driv
+1
View File
@@ -909,3 +909,4 @@ if __name__ == '__main__':
+1
View File
@@ -125,3 +125,4 @@ if __name__ == "__main__":
+1
View File
@@ -178,3 +178,4 @@ if __name__ == '__main__':
+48 -47
View File
@@ -60,13 +60,13 @@ class Qdb(bdb.Bdb):
request = self.pipe.recv()
if request.get("method") == 'run':
return None
response = {'version': '1.1', 'id': request.get('id'),
'result': None,
response = {'version': '1.1', 'id': request.get('id'),
'result': None,
'error': None}
try:
# dispatch message (JSON RPC like)
method = getattr(self, request['method'])
response['result'] = method.__call__(*request['args'],
response['result'] = method.__call__(*request['args'],
**request.get('kwargs', {}))
except Exception, e:
response['error'] = {'code': 0, 'message': str(e)}
@@ -101,7 +101,7 @@ class Qdb(bdb.Bdb):
return
if self.stop_here(frame):
self.interaction(frame, None)
def user_line(self, frame):
"""This function is called when we stop or break at this line."""
if self._wait_for_mainpyfile:
@@ -126,8 +126,8 @@ class Qdb(bdb.Bdb):
trace = traceback.extract_tb(trace)
title = traceback.format_exception_only(extype, exvalue)[0]
# send an Exception notification
msg = {'method': 'exception',
'args': (title, extype.__name__, exvalue, trace, msg),
msg = {'method': 'exception',
'args': (title, extype.__name__, exvalue, trace, msg),
'id': None}
self.pipe.send(msg)
self.interaction(frame, info)
@@ -156,7 +156,7 @@ class Qdb(bdb.Bdb):
"imp" : imp, # need for run
})
# avoid stopping before we reach the main script
# avoid stopping before we reach the main script
self._wait_for_mainpyfile = 1
self.mainpyfile = self.canonic(filename)
self._user_requested_quit = 0
@@ -180,8 +180,8 @@ class Qdb(bdb.Bdb):
if code.co_name != "?":
message = "%s: %s()" % (message, code.co_name)
# wait user events
self.waiting = True
# wait user events
self.waiting = True
self.frame = frame
try:
while self.waiting:
@@ -270,7 +270,7 @@ class Qdb(bdb.Bdb):
else:
first = arg
elif not self._lineno:
first = max(1, self.frame.f_lineno - 5)
first = max(1, self.frame.f_lineno - 5)
else:
first = self._lineno + 1
if last is None:
@@ -302,7 +302,7 @@ class Qdb(bdb.Bdb):
if self.breaks: # There's at least one
for bp in bdb.Breakpoint.bpbynumber:
if bp:
breaks.append((bp.number, bp.file, bp.line,
breaks.append((bp.number, bp.file, bp.line,
bp.temporary, bp.enabled, bp.hits, bp.cond, ))
return breaks
@@ -367,13 +367,13 @@ class Qdb(bdb.Bdb):
return []
else:
return dir(obj)
def get_call_tip(self, expression):
"Return list of auto-completion options for expression"
try:
obj = self.do_eval(expression)
except Exception, e:
return ('', '', str(e))
return ('', '', str(e))
else:
name = ''
try:
@@ -479,7 +479,7 @@ class Qdb(bdb.Bdb):
"Replacement for stdout.write()"
msg = {'method': 'write', 'args': (text, ), 'id': None}
self.pipe.send(msg)
def writelines(self, l):
map(self.write, l)
@@ -492,7 +492,7 @@ class Qdb(bdb.Bdb):
class QueuePipe(object):
"Simulated pipe for threads (using two queues)"
def __init__(self, name, in_queue, out_queue):
self.__name = name
self.in_queue = in_queue
@@ -516,10 +516,10 @@ class RPCError(RuntimeError):
"Remote Error (not user exception)"
pass
class Frontend(object):
"Qdb generic Frontend interface"
def __init__(self, pipe):
self.i = 1
self.pipe = pipe
@@ -546,7 +546,7 @@ class Frontend(object):
def interaction(self, filename, lineno, line, *kwargs):
raise NotImplementedError
def exception(self, title, extype, exvalue, trace, request):
"Show a user_exception"
raise NotImplementedError
@@ -554,7 +554,7 @@ class Frontend(object):
def write(self, text):
"Console output (print)"
raise NotImplementedError
def readline(self, text):
"Console input/rawinput"
raise NotImplementedError
@@ -566,10 +566,10 @@ class Frontend(object):
# wait for a message...
request = self.recv()
else:
# process an asyncronus notification received earlier
# process an asyncronus notification received earlier
request = self.notifies.pop(0)
return self.process_message(request)
def process_message(self, request):
if request:
result = None
@@ -588,8 +588,8 @@ class Frontend(object):
elif request.get('method') == 'readline':
result = self.readline()
if result:
response = {'version': '1.1', 'id': request.get('id'),
'result': result,
response = {'version': '1.1', 'id': request.get('id'),
'result': result,
'error': None}
self.send(response)
return True
@@ -619,20 +619,20 @@ class Frontend(object):
def do_step(self, arg=None):
"Execute the current line, stop at the first possible occasion"
self.call('do_step')
def do_next(self, arg=None):
"Execute the current line, do not stop at function calls"
self.call('do_next')
def do_continue(self, arg=None):
def do_continue(self, arg=None):
"Continue execution, only stop when a breakpoint is encountered."
self.call('do_continue')
def do_return(self, arg=None):
def do_return(self, arg=None):
"Continue execution until the current function returns"
self.call('do_return')
def do_jump(self, arg):
def do_jump(self, arg):
"Set the next line that will be executed."
res = self.call('do_jump', arg)
print res
@@ -644,7 +644,7 @@ class Frontend(object):
def do_quit(self, arg=None):
"Quit from the debugger. The program being executed is aborted."
self.call('do_quit')
def do_eval(self, expr):
"Inspect the value of the expression"
return self.call('do_eval', expr)
@@ -672,11 +672,11 @@ class Frontend(object):
def do_clear_file_breakpoints(self, filename):
"Remove all breakpoints at filename"
self.call('do_clear_breakpoints', filename, lineno)
def do_list_breakpoint(self):
"List all breakpoints"
return self.call('do_list_breakpoint')
def do_exec(self, statement):
return self.call('do_exec', statement)
@@ -685,7 +685,7 @@ class Frontend(object):
def get_call_tip(self, expression):
return self.call('get_call_tip', expression)
def interrupt(self):
"Immediately stop at the first possible occasion (outside interaction)"
# this is a notification!, do not expect a response
@@ -695,7 +695,7 @@ class Frontend(object):
def set_burst(self, value):
req = {'method': 'set_burst', 'args': (value, )}
self.send(req)
def set_params(self, params):
req = {'method': 'set_params', 'args': (params, )}
self.send(req)
@@ -703,13 +703,13 @@ class Frontend(object):
class Cli(Frontend, cmd.Cmd):
"Qdb Front-end command line interface"
def __init__(self, pipe, completekey='tab', stdin=None, stdout=None, skip=None):
cmd.Cmd.__init__(self, completekey, stdin, stdout)
Frontend.__init__(self, pipe)
# redefine Frontend methods:
def run(self):
while 1:
try:
@@ -731,18 +731,18 @@ class Cli(Frontend, cmd.Cmd):
def write(self, text):
print text,
def readline(self):
return raw_input()
def postcmd(self, stop, line):
return not line.startswith("h") # stop
do_h = cmd.Cmd.do_help
do_s = Frontend.do_step
do_n = Frontend.do_next
do_c = Frontend.do_continue
do_c = Frontend.do_continue
do_r = Frontend.do_return
do_j = Frontend.do_jump
do_q = Frontend.do_quit
@@ -750,12 +750,12 @@ class Cli(Frontend, cmd.Cmd):
def do_eval(self, args):
"Inspect the value of the expression"
print Frontend.do_eval(self, args)
def do_list(self, args):
"List source code for the current file"
lines = Frontend.do_list(self, eval(args, {}, {}) if args else None)
self.print_lines(lines)
def do_where(self, args):
"Print a stack trace, with the most recent frame at the bottom."
lines = Frontend.do_where(self)
@@ -831,7 +831,7 @@ def test():
front_conn = QueuePipe("parent", parent_queue, child_queue)
child_conn = QueuePipe("child", child_queue, parent_queue)
p = Thread(target=f, args=(child_conn,))
p.start()
import time
@@ -844,7 +844,7 @@ def test():
qdb = Test(front_conn)
time.sleep(5)
while 1:
print "running..."
Frontend.run(qdb)
@@ -856,7 +856,7 @@ def test():
def connect(host="localhost", port=6000, authkey='secret password'):
"Connect to a running debugger backend"
address = (host, port)
from multiprocessing.connection import Client
@@ -872,7 +872,7 @@ def connect(host="localhost", port=6000, authkey='secret password'):
def main(host='localhost', port=6000, authkey='secret password'):
"Debug a script and accept a remote frontend"
if not sys.argv[1:] or sys.argv[1] in ("--help", "-h"):
print "usage: pdb.py scriptfile [arg] ..."
sys.exit(2)
@@ -916,7 +916,7 @@ qdb = None
def set_trace(host='localhost', port=6000, authkey='secret password'):
"Simplified interface to debug running programs"
global qdb, listener, conn
from multiprocessing.connection import Listener
# only create it if not currently instantiated
if not qdb:
@@ -940,7 +940,7 @@ def quit():
conn.close()
conn = None
if listener:
listener.close()
listener.close()
listener = None
if __name__ == '__main__':
@@ -962,3 +962,4 @@ if __name__ == '__main__':
import qdb
qdb.main(**kwargs)
+7 -6
View File
@@ -67,7 +67,7 @@ class RedisClient(object):
}}
else:
self.storage = self.meta_storage[app]
self.r_server = redis.Redis(host=host, port=port, db=self.db)
def __call__(self, key, f, time_expire=300):
@@ -96,7 +96,7 @@ class RedisClient(object):
return value
except ConnectionError:
return self.retry_call(key, f, time_expire)
def retry_call(self, key, f, time_expire):
self.RETRIES += 1
if self.RETRIES <= self.MAX_RETRIES:
@@ -107,19 +107,19 @@ class RedisClient(object):
else:
self.RETRIES = 0
raise ConnectionError , 'Redis instance is unavailable at %s' % (self.server)
def increment(self, key, value=1, time_expire=300):
try:
newKey = self.__keyFormat__(key)
obj = self.r_server.get(newKey)
obj = self.r_server.get(newKey)
if obj:
return self.r_server.incr(newKey, value)
return self.r_server.incr(newKey, value)
else:
self.r_server.setex(newKey, value, time_expire)
return value
except ConnectionError:
return self.retry_increment(key, value, time_expire)
def retry_increment(self, key, value, time_expire):
self.RETRIES += 1
if self.RETRIES <= self.MAX_RETRIES:
@@ -165,3 +165,4 @@ class RedisClient(object):
key.replace(' ', '_'))
+1
View File
@@ -590,3 +590,4 @@ if __name__ == '__main__':
+1
View File
@@ -268,3 +268,4 @@ if __name__=='__main__':
+1
View File
@@ -149,3 +149,4 @@ if __name__ == "__main__":
client = ServerProxy(location, verbose='--verbose' in sys.argv,)
print client.add(1, 2)
+1
View File
@@ -114,3 +114,4 @@ def sms_email(number,provider):
+1
View File
@@ -264,3 +264,4 @@ if __name__ == '__main__':
+1
View File
@@ -64,3 +64,4 @@ if __name__=='__main__':
print 'refunded',s['refunded']
+1
View File
@@ -245,3 +245,4 @@ class TaskBarIcon:
+12 -11
View File
@@ -14,10 +14,10 @@ class TimeCollector(object):
'''Private utility function to clean up this common calculation.'''
return self.scores[index1].stamp - self.scores[index2].stamp
def getReportItems(self, orderByCost=True):
'''Returns a list of dicts. Each dict has
start (ms),
end (ms),
delta (ms),
'''Returns a list of dicts. Each dict has
start (ms),
end (ms),
delta (ms),
perc (%),
tag (str)
'''
@@ -37,9 +37,9 @@ class TimeCollector(object):
delta = delta * 1000,
perc = perc,
tag = self.scores[i].tag
)
)
)
if orderByCost:
if orderByCost:
data.sort(key=lambda x: x['perc'], reverse=True)
return data
def getReportLines(self, orderByCost=True):
@@ -49,20 +49,20 @@ class TimeCollector(object):
data = self.getReportItems(orderByCost)
headerTemplate = '%10s | %10s | %10s | %11s | %-30s'
headerData = ('Start(ms)', 'End(ms)', 'Delta(ms)', 'Time Cost',
'Description')
'Description')
bodyTemplate = '%(start)10.0f | %(end)10.0f | %(delta)10.0f |' \
+ ' %(perc)10.0f%% | %(tag)-30s'
+ ' %(perc)10.0f%% | %(tag)-30s'
return [headerTemplate % headerData] + [bodyTemplate % d for d in data]
def getReportText(self, **kwargs):
return '\n'.join(self.getReportLines(**kwargs))
def restart(self):
self.scores = [Score(tag='start',stamp=time.clock())]
if __name__=='__main__':
print('')
print('Testing:')
print('')
# First create the collector
t = TimeCollector()
x = [i for i in range(1000)]
@@ -85,7 +85,7 @@ if __name__=='__main__':
# And once again report results
print('')
print(t.getReportText())
t.restart()
t.restart()
for y in range(1, 200, 20):
x = [i for i in range(10000)*y]
t.addStamp('Iteration when y = ' + str(y))
@@ -93,3 +93,4 @@ if __name__=='__main__':
print('')
# You can turn off ordering of results
print(t.getReportText(orderByCost=False))
+1
View File
@@ -518,3 +518,4 @@ class mobilize(object):
return self.func()
+1
View File
@@ -327,3 +327,4 @@ class _Web2pyDateTrackerImporter(_Web2pyImporter, _DateTrackerImporter):
+45 -44
View File
@@ -585,7 +585,7 @@ class BaseAdapter(ConnectionPool):
polymodel=None):
fields = []
# PostGIS geo fields are added after the table has been created
postcreation_fields = []
postcreation_fields = []
sql_fields = {}
sql_fields_aux = {}
TFK = {}
@@ -1267,7 +1267,7 @@ class BaseAdapter(ConnectionPool):
[itables_to_merge.update(dict.fromkeys(self.tables(t))) for t in ijoinon] # issue 490
ijoinont = [t.first._tablename for t in ijoinon]
[itables_to_merge.pop(t) for t in ijoinont if t in itables_to_merge] #issue 490
iimportant_tablenames = ijoint + ijoinont + itables_to_merge.keys() # issue 490
iimportant_tablenames = ijoint + ijoinont + itables_to_merge.keys() # issue 490
iexcluded = [t for t in tablenames if not t in iimportant_tablenames]
if left:
join = attributes['left']
@@ -1534,7 +1534,7 @@ class BaseAdapter(ConnectionPool):
elif field_type.startswith('geo'):
return value
elif field_type == 'blob' and not blob_decode:
return value
return value
else:
key = regex_type.match(field_type).group(0)
return self.parsemap[key](value,field_type)
@@ -2091,14 +2091,14 @@ class PostgreSQLAdapter(BaseAdapter):
elif first.type.startswith('list:'):
key = '%|'+str(second).replace('|','||').replace('%','%%')+'|%'
return '(%s ILIKE %s)' % (self.expand(first),self.expand(key,'string'))
# GIS functions
def ST_ASGEOJSON(self, first, second):
"""
http://postgis.org/docs/ST_AsGeoJSON.html
"""
return 'ST_AsGeoJSON(%s,%s,%s,%s)' %(second['version'],
return 'ST_AsGeoJSON(%s,%s,%s,%s)' %(second['version'],
self.expand(first), second['precision'], second['options'])
def ST_ASTEXT(self, first):
@@ -2106,7 +2106,7 @@ class PostgreSQLAdapter(BaseAdapter):
http://postgis.org/docs/ST_AsText.html
"""
return 'ST_AsText(%s)' %(self.expand(first))
# def ST_CONTAINED(self, first, second):
# """
# non-standard function based on ST_Contains with parameters reversed
@@ -2119,43 +2119,43 @@ class PostgreSQLAdapter(BaseAdapter):
http://postgis.org/docs/ST_Contains.html
"""
return 'ST_Contains(%s,%s)' %(self.expand(first), self.expand(second, first.type))
def ST_DISTANCE(self, first, second):
"""
http://postgis.org/docs/ST_Distance.html
"""
return 'ST_Distance(%s,%s)' %(self.expand(first), self.expand(second, first.type))
def ST_EQUALS(self, first, second):
"""
http://postgis.org/docs/ST_Equals.html
"""
return 'ST_Equals(%s,%s)' %(self.expand(first), self.expand(second, first.type))
def ST_INTERSECTS(self, first, second):
"""
http://postgis.org/docs/ST_Intersects.html
"""
return 'ST_Intersects(%s,%s)' %(self.expand(first), self.expand(second, first.type))
def ST_OVERLAPS(self, first, second):
"""
http://postgis.org/docs/ST_Overlaps.html
"""
return 'ST_Overlaps(%s,%s)' %(self.expand(first), self.expand(second, first.type))
def ST_SIMPLIFY(self, first, second):
"""
http://postgis.org/docs/ST_Simplify.html
"""
return 'ST_Simplify(%s,%s)' %(self.expand(first), self.expand(second, 'double'))
def ST_TOUCHES(self, first, second):
"""
http://postgis.org/docs/ST_Touches.html
"""
return 'ST_Touches(%s,%s)' %(self.expand(first), self.expand(second, first.type))
def ST_WITHIN(self, first, second):
"""
http://postgis.org/docs/ST_Within.html
@@ -2177,8 +2177,8 @@ class PostgreSQLAdapter(BaseAdapter):
# raise SyntaxError, 'Invalid field type %s' %fieldtype
return value
return BaseAdapter.represent(self, obj, fieldtype)
class JDBCPostgreSQLAdapter(PostgreSQLAdapter):
def __init__(self,db,uri,pool_size=0,folder=None,db_codec ='UTF-8',
@@ -2486,37 +2486,37 @@ class MSSQLAdapter(BaseAdapter):
if maximum is None:
return rows[minimum:]
return rows[minimum:maximum]
# GIS functions
# No STAsGeoJSON in MSSQL
def ST_ASTEXT(self, first):
return '%s.STAsText()' %(self.expand(first))
return '%s.STAsText()' %(self.expand(first))
def ST_CONTAINS(self, first, second):
return '%s.STContains(%s)=1' %(self.expand(first), self.expand(second, first.type))
def ST_DISTANCE(self, first, second):
return '%s.STDistance(%s)' %(self.expand(first), self.expand(second, first.type))
def ST_EQUALS(self, first, second):
return '%s.STEquals(%s)=1' %(self.expand(first), self.expand(second, first.type))
def ST_INTERSECTS(self, first, second):
return '%s.STIntersects(%s)=1' %(self.expand(first), self.expand(second, first.type))
def ST_OVERLAPS(self, first, second):
return '%s.STOverlaps(%s)=1' %(self.expand(first), self.expand(second, first.type))
# no STSimplify in MSSQL
def ST_TOUCHES(self, first, second):
return '%s.STTouches(%s)=1' %(self.expand(first), self.expand(second, first.type))
def ST_WITHIN(self, first, second):
return '%s.STWithin(%s)=1' %(self.expand(first), self.expand(second, first.type))
def represent(self, obj, fieldtype):
if fieldtype.startswith('geometry'):
srid = 0 # MS SQL default srid for geometry
@@ -7023,7 +7023,7 @@ class Table(dict):
def _insert(self, **fields):
return self._db._adapter._insert(self,self._listify(fields))
def insert(self, **fields):
def insert(self, **fields):
if any(f(fields) for f in self._before_insert): return 0
ret = self._db._adapter.insert(self,self._listify(fields))
ret and [f(fields) for f in self._after_insert]
@@ -7344,39 +7344,39 @@ class Expression(object):
# GIS functions
def st_asgeojson(self, precision=15, options=0, version=1):
return Expression(self.db, self.db._adapter.ST_ASGEOJSON, self,
return Expression(self.db, self.db._adapter.ST_ASGEOJSON, self,
dict(precision=precision, options=options, version=version), 'dict')
def st_astext(self):
return Expression(self.db, self.db._adapter.ST_ASTEXT, self)
def st_contained(self, value):
return Query(self.db, self.db._adapter.ST_CONTAINS, value, self)
return Query(self.db, self.db._adapter.ST_CONTAINS, value, self)
def st_contains(self, value):
return Query(self.db, self.db._adapter.ST_CONTAINS, self, value)
return Query(self.db, self.db._adapter.ST_CONTAINS, self, value)
def st_distance(self, other):
return Expression(self.db,self.db._adapter.ST_DISTANCE,self,other,self.type)
def st_equals(self, value):
return Query(self.db, self.db._adapter.ST_EQUALS, self, value)
def st_intersects(self, value):
return Query(self.db, self.db._adapter.ST_INTERSECTS, self, value)
return Query(self.db, self.db._adapter.ST_INTERSECTS, self, value)
def st_overlaps(self, value):
return Query(self.db, self.db._adapter.ST_OVERLAPS, self, value)
def st_simplify(self, value):
return Expression(self.db, self.db._adapter.ST_SIMPLIFY, self, value)
def st_touches(self, value):
return Query(self.db, self.db._adapter.ST_TOUCHES, self, value)
def st_within(self, value):
return Query(self.db, self.db._adapter.ST_WITHIN, self, value)
return Query(self.db, self.db._adapter.ST_WITHIN, self, value)
# for use in both Query and sortby
@@ -7830,7 +7830,7 @@ class Set(object):
table = self.db[tablename]
if any(f(self,update_fields) for f in table._before_update): return 0
fields = table._listify(update_fields,update=True)
if not fields: raise SyntaxError, "No fields to update"
if not fields: raise SyntaxError, "No fields to update"
ret = self.db._adapter.update(tablename,self.query,fields)
ret and [f(self,update_fields) for f in table._after_update]
return ret
@@ -7842,7 +7842,7 @@ class Set(object):
tablename = self.db._adapter.get_table(self.query)
table = self.db[tablename]
fields = table._listify(update_fields,update=True)
if not fields: raise SyntaxError, "No fields to update"
if not fields: raise SyntaxError, "No fields to update"
ret = self.db._adapter.update(tablename,self.query,fields)
return ret
@@ -8478,3 +8478,4 @@ if __name__ == '__main__':
doctest.testmod()
+6 -5
View File
@@ -103,10 +103,10 @@ def check_interaction(fn):
interact_lock.release()
return check_fn
class WebDebugger(qdb.Frontend):
"Qdb web2py interface"
def __init__(self, pipe, completekey='tab', stdin=None, stdout=None):
qdb.Frontend.__init__(self, pipe)
self.clear_interaction()
@@ -118,7 +118,7 @@ class WebDebugger(qdb.Frontend):
self.context = None
# redefine Frontend methods:
def run(self):
run_lock.acquire()
try:
@@ -138,7 +138,7 @@ class WebDebugger(qdb.Frontend):
interact_lock.release()
def exception(self, title, extype, exvalue, trace, request):
self.exception_info = {'title': title,
self.exception_info = {'title': title,
'extype': extype, 'exvalue': exvalue,
'trace': trace, 'request': request}
@@ -173,7 +173,7 @@ class WebDebugger(qdb.Frontend):
return qdb.Frontend.do_exec(self, statement)
finally:
interact_lock.release()
# create the connection between threads:
parent_queue, child_queue = Queue.Queue(), Queue.Queue()
@@ -190,3 +190,4 @@ qdb_debugger.set_params(dict(call_stack=True, environment=True))
import gluon.main
gluon.main.global_settings.debugging = True
+1
View File
@@ -76,3 +76,4 @@ def decoder(buffer):
+1
View File
@@ -398,3 +398,4 @@ def make_fake_file_like_object():
+3 -2
View File
@@ -111,7 +111,7 @@ class Request(Storage):
for key,value in user_agent.items():
if isinstance(value,dict): user_agent[key] = Storage(value)
return user_agent
def requires_https(self):
"""
If request comes in over HTTP, redirect it to HTTPS
@@ -119,7 +119,7 @@ class Request(Storage):
"""
if not global_settings.cronjob and not self.is_https:
redirect(URL(scheme='https', args=self.args, vars=self.vars))
current.session.secure()
def restful(self):
@@ -618,3 +618,4 @@ class Session(Storage):
+1
View File
@@ -346,3 +346,4 @@ if __name__ == '__main__':
+3 -2
View File
@@ -190,7 +190,7 @@ def URL(
>>> str(URL(a='a', c='c', f='f', vars={'id' : '%(id)d' }, url_encode=True))
'/a/c/f?id=%25%28id%29d'
>>> str(URL(a='a', c='c', f='f', anchor='%(id)d', url_encode=False))
'/a/c/f#%(id)d'
@@ -1423,7 +1423,7 @@ class CODE(DIV):
link = self['link']
counter = self.attributes.get('counter', 1)
highlight_line = self.attributes.get('highlight_line', None)
context_lines = self.attributes.get('context_lines', None)
context_lines = self.attributes.get('context_lines', None)
styles = self['styles'] or {}
return highlight(
join(self.components),
@@ -2359,3 +2359,4 @@ if __name__ == '__main__':
+1
View File
@@ -130,3 +130,4 @@ def redirect(location, how=303):
+1
View File
@@ -111,3 +111,4 @@ for module in base_modules + contributed_modules:
+3 -2
View File
@@ -49,7 +49,7 @@ def read_dict_aux(filename):
logging.error('Syntax error in %s' % filename)
return {'__corrupted__':True}
def read_dict(filename):
def read_dict(filename):
return getcfs('language:%s'%filename,filename,
lambda filename=filename:read_dict_aux(filename))
@@ -294,7 +294,7 @@ class translator(object):
self.t[message] = mt = tokens[0]
if self.language_file and not is_gae:
write_dict(self.language_file, self.t)
if symbols or symbols == 0:
if symbols or symbols == 0 or symbols == "":
return mt % symbols
return mt
@@ -351,3 +351,4 @@ if __name__ == '__main__':
+1
View File
@@ -833,3 +833,4 @@ class HttpServer(object):
+1
View File
@@ -30,3 +30,4 @@ regex_extend = re.compile(\
+1
View File
@@ -337,3 +337,4 @@ def crondance(applications_parent, ctype='soft', startup=False):
+1
View File
@@ -149,3 +149,4 @@ if __name__=='__main__':
print f.read()
f.close()
+1
View File
@@ -1715,3 +1715,4 @@ ADAPTERS['all'] = reduce(lambda a,b:a.union(b),(x for x in ADAPTERS.values()))
+1
View File
@@ -305,3 +305,4 @@ def snapshot(info=None, context=5, code=None, environment=None):
+1
View File
@@ -1274,3 +1274,4 @@ def get_effective_router(appname):
+1
View File
@@ -2075,3 +2075,4 @@ if __name__=='__main__':
demo()
+1
View File
@@ -226,3 +226,4 @@ def sanitize(text, permitted_tags=[
+1
View File
@@ -550,3 +550,4 @@ def main():
if __name__=='__main__':
main()
+1
View File
@@ -87,3 +87,4 @@ def rss(feed):
+1
View File
@@ -12,3 +12,4 @@ settings = global_settings # legacy compatibility
+1
View File
@@ -420,3 +420,4 @@ if __name__ == '__main__':
+1
View File
@@ -7,3 +7,4 @@ from dal import DAL, Field, Table, Query, Set, Expression, Row, Rows, drivers, B
+7 -6
View File
@@ -571,7 +571,7 @@ class AutocompleteWidget(object):
if self.is_reference:
id_field = self.fields[1]
if self.help_fields:
options = [OPTION(self.help_string % dict([(h.name,s[h.name]) for h in self.fields[:1]+self.help_fields]),
options = [OPTION(self.help_string % dict([(h.name,s[h.name]) for h in self.fields[:1]+self.help_fields]),
_value=s[id_field.name], _selected=(k==0)) for k,s in enumerate(rows)]
else:
options = [OPTION(s[field.name],_value=s[id_field.name],
@@ -1005,7 +1005,7 @@ class SQLFORM(FORM):
elif callable(self.formstyle):
table = TABLE()
for id,a,b,c in xfields:
raw_b = self.field_parent[id] = b
raw_b = self.field_parent[id] = b
newrows = self.formstyle(id,a,raw_b,c)
if type(newrows).__name__ != "tuple":
newrows = [newrows]
@@ -1388,8 +1388,8 @@ class SQLFORM(FORM):
var k=jQuery('#web2py_keywords');
var v=k.val();
if(aggregator=='new') k.val(s); else k.val((v?(v+' '+ aggregator +' '):'')+s);
jQuery('#w2p_query_panel').slideUp();
}
jQuery('#w2p_query_panel').slideUp();
}
""")
return CAT(
INPUT(
@@ -1835,7 +1835,7 @@ class SQLFORM(FORM):
value = A('File',
_href='%s/%s' % (upload, value))
else:
value = ''
value = ''
elif isinstance(value,str):
value = truncate_string(value,maxlength)
else:
@@ -1956,7 +1956,7 @@ class SQLFORM(FORM):
previous_tablename,previous_fieldname,previous_id = \
tablename,fieldname,id
try:
format = db[referee]._format
format = db[referee]._format
if callable(format): name = format(record)
else: name = format % record
except TypeError:
@@ -2296,3 +2296,4 @@ form_factory = SQLFORM.factory # for backward compatibility, deprecated
+1
View File
@@ -226,3 +226,4 @@ if __name__ == '__main__':
+1
View File
@@ -110,3 +110,4 @@ def stream_file_or_304_or_206(
+1
View File
@@ -937,3 +937,4 @@ if __name__ == '__main__':
+8 -7
View File
@@ -1003,7 +1003,7 @@ class Auth(object):
settings.reset_password_onvalidation = []
settings.reset_password_onaccept = []
settings.email_case_sensitive = True
settings.email_case_sensitive = True
settings.username_case_sensitive = True
settings.hmac_key = hmac_key
@@ -1199,7 +1199,7 @@ class Auth(object):
li_next = '?_next='+urllib.quote(self.settings.login_next)
lo_next = '?_next='+urllib.quote(self.settings.logout_next)
if self.user_id:
logout=A(T('Logout'),_href=action+'/logout'+lo_next)
profile=A(T('Profile'),_href=action+'/profile'+next)
@@ -1339,7 +1339,7 @@ class Auth(object):
Field('role', length=512, default='',
label=self.messages.label_role),
Field('description', 'text',
label=self.messages.label_description),
label=self.messages.label_description),
*settings.extra_fields.get(settings.table_group_name,[]),
**dict(
migrate=self.__get_migrate(
@@ -1829,7 +1829,7 @@ class Auth(object):
session.flash = self.messages.logged_in
self.update_groups()
# how to continue
if self.settings.login_form == self:
if accepted_form:
@@ -1974,7 +1974,7 @@ class Auth(object):
session.auth = Storage(user=user, last_visit=request.now,
expiration=self.settings.expiration,
hmac_key = web2py_uuid())
self.user = user
self.user = user
self.update_groups()
session.flash = self.messages.logged_in
self.log_event(log, form.vars)
@@ -4183,7 +4183,7 @@ class Expose(object):
if not os.path.isdir(filename):
current.response.headers['Content-Type'] = contenttype(filename)
raise HTTP(200,open(filename,'rb'),**current.response.headers)
self.path = path = os.path.join(filename,'*')
self.path = path = os.path.join(filename,'*')
self.folders = [f[len(path)-1:] for f in sorted(glob.glob(path)) \
if os.path.isdir(f) and not self.isprivate(f)]
self.filenames = [f[len(path)-1:] for f in sorted(glob.glob(path)) \
@@ -4204,7 +4204,7 @@ class Expose(object):
def table_folders(self):
return TABLE(*[TR(TD(A(folder,_href=URL(args=self.args+[folder])))) \
for folder in self.folders])
for folder in self.folders])
@staticmethod
def isprivate(f):
return 'private' in f or f.startswith('.') or f.endswith('~')
@@ -4233,3 +4233,4 @@ if __name__ == '__main__':
doctest.testmod()
+1
View File
@@ -128,3 +128,4 @@ def web2py_uuid():
+3 -2
View File
@@ -535,7 +535,7 @@ class IS_NOT_IN_DB(Validator):
self.record_id = 0
self.allowed_override = allowed_override
self.ignore_common_filters = ignore_common_filters
def set_self_id(self, id):
self.record_id = id
@@ -547,7 +547,7 @@ class IS_NOT_IN_DB(Validator):
return (value, None)
(tablename, fieldname) = str(self.field).split('.')
table = self.dbset.db[tablename]
field = table[fieldname]
field = table[fieldname]
rows = self.dbset(field == value, ignore_common_filters = self.ignore_common_filters).select(limitby=(0, 1))
if len(rows) > 0:
if isinstance(self.record_id, dict):
@@ -2992,3 +2992,4 @@ if __name__ == '__main__':
+1
View File
@@ -984,3 +984,4 @@ def start(cron=True):
+1
View File
@@ -165,3 +165,4 @@ if __name__ == '__main__':
+1
View File
@@ -23,3 +23,4 @@ def handler(request, response, methods):
+1
View File
@@ -35,3 +35,4 @@ if __name__=='__main__':
HandleCommandLine(params)
+1
View File
@@ -224,3 +224,4 @@ def handler(req):
return apache.OK
+1
View File
@@ -33,3 +33,4 @@ extcron = None
nocron = None
+1
View File
@@ -207,3 +207,4 @@ if __name__ == '__main__':
doctest.testmod()
+1
View File
@@ -172,3 +172,4 @@ if __name__ == '__main__':
doctest.testmod()
+1
View File
@@ -73,3 +73,4 @@ if SOFTCRON:
#scgi.serve_application(application, '', 4000).run()
SCGIServer(application, port=4000).enable_sighandler().run()
+1
View File
@@ -79,3 +79,4 @@ if __name__ == '__main__':
start()
+1
View File
@@ -54,3 +54,4 @@ setup(app=['web2py.py'],
setup_requires=['py2app'])
+1
View File
@@ -184,3 +184,4 @@ print "Finished!"
print "Enjoy web2py " +web2py_version_line
+1
View File
@@ -166,3 +166,4 @@ print "Finished!"
print "Enjoy web2py " +web2py_version_line
+1
View File
@@ -20,3 +20,4 @@ if __name__ == '__main__':
gluon.widget.start(cron=True)
+1
View File
@@ -44,3 +44,4 @@ if SOFTCRON:
global_settings.web2py_crontype = 'soft'