fixed the case of missing tickets and a typo in last commit

This commit is contained in:
mdipierro
2012-08-28 22:14:59 -05:00
parent 415104345d
commit 4ef0e6cc94
5 changed files with 26 additions and 16 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.00.1 (2012-08-28 21:11:21) rc4 Version 2.00.1 (2012-08-28 22:14:54) rc4
+1
View File
@@ -107,6 +107,7 @@
'These files are not served, they are only available from within your app': 'These files are not served, they are only available from within your app', 'These files are not served, they are only available from within your app': 'These files are not served, they are only available from within your app',
'These files are served without processing, your images go here': 'These files are served without processing, your images go here', 'These files are served without processing, your images go here': 'These files are served without processing, your images go here',
'Ticket ID': 'Ticket ID', 'Ticket ID': 'Ticket ID',
'Ticket Missing': 'Ticket Missing',
'To create a plugin, name a file/folder plugin_[name]': 'To create a plugin, name a file/folder plugin_[name]', 'To create a plugin, name a file/folder plugin_[name]': 'To create a plugin, name a file/folder plugin_[name]',
'Traceback': 'Traceback', 'Traceback': 'Traceback',
'Translation strings for the application': 'Translation strings for the application', 'Translation strings for the application': 'Translation strings for the application',
+7 -1
View File
@@ -13,12 +13,16 @@
<th>web2py&trade;</th> <th>web2py&trade;</th>
<td>{{=myversion}}</td> <td>{{=myversion}}</td>
</tr> </tr>
{{if snapshot:}}
<tr> <tr>
<th>Python</th> <th>Python</th>
<td>{{=snapshot.get('pyver','')}}</td> <td>{{=snapshot.get('pyver','')}}</td>
</tr> </tr>
{{pass}}
</tbody> </tbody>
</table> </table>
{{if traceback or code or layer:}}
<h3>{{=T('Traceback')}}</h3> <h3>{{=T('Traceback')}}</h3>
<div class="inspect"> <div class="inspect">
{{=traceback}} {{=traceback}}
@@ -130,4 +134,6 @@
<h3>In file: {{=layer}}</h3> <h3>In file: {{=layer}}</h3>
{{=CODE(code.replace('\r',''),language='python',link='/examples/global/vars/')}} {{=CODE(code.replace('\r',''),language='python',link='/examples/global/vars/')}}
</div> </div>
{{else:}}
<h3>{{=T('Ticket Missing')}}</h3>
{{pass}}
+4 -4
View File
@@ -90,7 +90,7 @@ from dal import BaseAdapter
from settings import global_settings from settings import global_settings
from validators import CRYPT from validators import CRYPT
from cache import Cache from cache import Cache
from html import URL as Url, xmlescape from html import URL, xmlescape
from utils import is_valid_ip_address from utils import is_valid_ip_address
from rewrite import load, url_in, thread as rwthread, try_rewrite_on_error from rewrite import load, url_in, thread as rwthread, try_rewrite_on_error
import newcron import newcron
@@ -442,10 +442,10 @@ def wsgibase(environ, responder):
if not exists(request.folder): if not exists(request.folder):
if app == rwthread.routes.default_application \ if app == rwthread.routes.default_application \
and app != 'welcome': and app != 'welcome':
redirect(Url(app,'default','index')) redirect(URL('welcome','default','index'))
elif rwthread.routes.error_handler: elif rwthread.routes.error_handler:
_handler = rwthread.routes.error_handler _handler = rwthread.routes.error_handler
redirect(Url(_handler['application'], redirect(URL(_handler['application'],
_handler['controller'], _handler['controller'],
_handler['function'], _handler['function'],
args=app)) args=app))
@@ -456,7 +456,7 @@ def wsgibase(environ, responder):
elif not request.is_local and \ elif not request.is_local and \
exists(pjoin(request.folder,'DISABLED')): exists(pjoin(request.folder,'DISABLED')):
raise HTTP(503, "<html><body><h1>Temporarily down for maintenance</h1></body></html>") raise HTTP(503, "<html><body><h1>Temporarily down for maintenance</h1></body></html>")
request.url = Url(r=request, request.url = URL(r=request,
args=request.args, args=request.args,
extension=request.raw_extension) extension=request.raw_extension)
+13 -10
View File
@@ -88,16 +88,19 @@ class TicketStorage(Storage):
ticket_id, ticket_id,
): ):
if not self.db: if not self.db:
ef = self._error_file(request, ticket_id, 'rb', app) try:
ef = self._error_file(request, ticket_id, 'rb', app)
except IOError:
return {}
try: try:
return cPickle.load(ef) return cPickle.load(ef)
finally: finally:
ef.close() ef.close()
table = self._get_table(self.db, self.tablename, app) else:
rows = self.db(table.ticket_id == ticket_id).select() table = self._get_table(self.db, self.tablename, app)
if rows: rows = self.db(table.ticket_id == ticket_id).select()
return cPickle.loads(rows[0].ticket_data) return cPickle.loads(rows[0].ticket_data) if rows else {}
return None
class RestrictedError(Exception): class RestrictedError(Exception):
@@ -164,10 +167,10 @@ class RestrictedError(Exception):
ticket_storage = TicketStorage(db=request.tickets_db) ticket_storage = TicketStorage(db=request.tickets_db)
d = ticket_storage.load(request, app, ticket_id) d = ticket_storage.load(request, app, ticket_id)
self.layer = d['layer'] self.layer = d.get('layer')
self.code = d['code'] self.code = d.get('code')
self.output = d['output'] self.output = d.get('output')
self.traceback = d['traceback'] self.traceback = d.get('traceback')
self.snapshot = d.get('snapshot') self.snapshot = d.get('snapshot')
def __str__(self): def __str__(self):