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