fixed issue 964, thanks Jonathan
This commit is contained in:
@@ -1 +1 @@
|
||||
Version 2.0.8 (2012-09-09 09:14:46) stable
|
||||
Version 2.0.8 (2012-09-09 09:20:41) stable
|
||||
|
||||
+2
-2
@@ -220,9 +220,9 @@ def read_possible_plurals():
|
||||
create list of all possible plural rules files
|
||||
result is cached to increase speed
|
||||
"""
|
||||
plurals = {}
|
||||
try:
|
||||
import gluon.contrib.plural_rules as package
|
||||
plurals = {}
|
||||
import contrib.plural_rules as package
|
||||
for importer, modname, ispkg in pkgutil.iter_modules(package.__path__):
|
||||
if len(modname)==2:
|
||||
module = __import__(package.__name__+'.'+modname)
|
||||
|
||||
+8
-2
@@ -1063,6 +1063,11 @@ class MapUrlIn(object):
|
||||
raise HTTP(400, thread.routes.error_message % 'invalid request',
|
||||
web2py_error='invalid arg <%s>' % arg)
|
||||
|
||||
def sluggify(self):
|
||||
""
|
||||
self.request.env.update(
|
||||
(sluggify(k),v) for k,v in self.env.iteritems())
|
||||
|
||||
def update_request(self):
|
||||
'''
|
||||
update request from self
|
||||
@@ -1091,8 +1096,7 @@ class MapUrlIn(object):
|
||||
urllib.quote('/'+'/'.join(str(x) for x in self.args)) if self.args else '',
|
||||
('?' + self.query) if self.query else '')
|
||||
self.env['REQUEST_URI'] = uri
|
||||
self.request.env.update(
|
||||
(sluggify(k),v) for k,v in self.env.iteritems())
|
||||
self.sluggify()
|
||||
|
||||
@property
|
||||
def arg0(self):
|
||||
@@ -1282,6 +1286,7 @@ def map_url_in(request, env, app=False):
|
||||
#
|
||||
thread.routes = params # default to base routes
|
||||
map = MapUrlIn(request=request, env=env)
|
||||
map.sluggify()
|
||||
map.map_prefix() # strip prefix if present
|
||||
map.map_app() # determine application
|
||||
|
||||
@@ -1295,6 +1300,7 @@ def map_url_in(request, env, app=False):
|
||||
|
||||
root_static_file = map.map_root_static() # handle root-static files
|
||||
if root_static_file:
|
||||
map.update_request()
|
||||
return (root_static_file, map.env)
|
||||
# handle mapping of lang/static to static/lang in externally-rewritten URLs
|
||||
# in case we have to handle them ourselves
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Unit tests for gluon.sql
|
||||
Unit tests for gluon.dal
|
||||
"""
|
||||
|
||||
import sys
|
||||
@@ -424,7 +424,7 @@ class TestMinMaxSum(unittest.TestCase):
|
||||
|
||||
class TestCache(unittest.TestCase):
|
||||
def testRun(self):
|
||||
from gluon.cache import CacheInRam
|
||||
from cache import CacheInRam
|
||||
cache = CacheInRam()
|
||||
db = DAL('sqlite:memory:')
|
||||
db.define_table('t', Field('a'))
|
||||
|
||||
@@ -59,7 +59,10 @@ try:
|
||||
|
||||
def setUp(self):
|
||||
self.request = Storage()
|
||||
self.request.folder = 'applications/welcome'
|
||||
if os.path.isdir('gluon'):
|
||||
self.request.folder = 'applications/welcome'
|
||||
else:
|
||||
self.request.folder = os.path.realpath('../../applications/welcome')
|
||||
self.request.env = Storage()
|
||||
self.request.env.http_accept_language = 'en'
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ else:
|
||||
sys.path.append(os.path.realpath('../'))
|
||||
|
||||
import unittest
|
||||
from gluon.contrib.markmin.markmin2html import run_doctests
|
||||
from contrib.markmin.markmin2html import run_doctests
|
||||
|
||||
class TestMarkmin(unittest.TestCase):
|
||||
def testMarkmin(self):
|
||||
|
||||
@@ -11,7 +11,7 @@ else:
|
||||
sys.path.append(os.path.realpath('../'))
|
||||
|
||||
import unittest
|
||||
from gluon.contrib.webclient import WebClient
|
||||
from contrib.webclient import WebClient
|
||||
|
||||
class TestWeb(unittest.TestCase):
|
||||
def testWebClient(self):
|
||||
|
||||
Reference in New Issue
Block a user