Dustin C. Hatch
c69dbed7ee
routing: Correctly redirect when path info is empty ( fixes #7 )
...
When the application path info is empty (e.g. the WSGI script is mounted
somewhere other than the root), appending a trailing slash and redirecting
causes the new location to be calculated incorrectly. This is because the part
of the request URL before the application path is not taken into account, so
the new path always ends up being a literal `/`. This commit changes the
behavior of the `redir` function that is returned by
`milla.dispatch.routing.Router.resolve` to calculate the new path info
correctly in the redirect response.
2015-02-19 19:58:03 -06:00
Dustin C. Hatch
cf94a4d600
app: Fixed an issue with unicode responses in Python 2.7
...
If a controller callable returns a string, it needs to be wrapped in a
Response object. To determine if this is the case, the Application tests to
see if the returned object is an instance of `basestring`. Since `basestring`
doesn't exist in Python 3, only `str` is a valid return type.
Unfortunately, my way of testing whether the `basestring` type existed was
flawed. Instead of raising `NameError` when it doesn't exist,
`UnboundLocalError` (a subclass `NameError`) is *always* raised. Since the
exception handler sets `basestring` equal to `str` assuming this is Python 3,
most of the time this isn't a problem. If, however, the controller returns a
`unicode` object in Python 2, the `isinstance` call returns `False`, so the
response is not wrapped in a Response object.
Rather than try to reassign the `basestring` name, now we just use `_string`,
which will either be `basestring` (in Python 2) or `str` (in Python 3).
Apparently, the unit tests didn't cover this case...
2014-02-07 23:22:50 -06:00
Dustin C. Hatch
a2d8f6f098
Version bump
2013-01-22 13:02:17 -06:00
Dustin C. Hatch
8e699969e2
Added tag 0.2 for changeset 2d04d03ce334
2013-01-22 13:01:28 -06:00
Dustin C. Hatch
872461d515
Remove dev version tag for 0.2 release
2013-01-22 13:01:16 -06:00
Dustin C. Hatch
d068d22e38
Added README
2013-01-22 12:00:56 -06:00
Dustin C. Hatch
345333614c
New documentation
2013-01-22 10:47:39 -06:00
Dustin C. Hatch
14c8c28b9a
Update docstring for util.read_config
2013-01-21 22:10:24 -06:00
Dustin C. Hatch
243df2be47
Mark the milla.cli module as deprecated
2013-01-20 15:14:25 -06:00
Dustin C. Hatch
708e59125e
Bump documentation version
2013-01-20 15:00:45 -06:00
Dustin C. Hatch
fc42519f0d
Bump setup.py version
2013-01-20 14:45:55 -06:00
Dustin C. Hatch
9da12232d4
Add a `defaults` keyword to `milla.util.read_config`
2013-01-20 14:49:24 -06:00
Dustin C. Hatch
65ebf76b45
Move read_config to milla.util
2013-01-20 14:48:23 -06:00
Dustin C. Hatch
3408919faa
Merged branch py3k ( closes #2 )
2013-01-20 14:53:38 -06:00
Dustin C. Hatch
0064f70160
Update read_config for new API in Python 3.2
...
--HG--
branch : py3k
2013-01-05 10:38:05 -06:00
Dustin C. Hatch
fed7d0fb3d
Merge default into py3k
...
--HG--
branch : py3k
2012-12-19 15:38:36 -06:00
Dustin C. Hatch
4085039997
Added simple inifile-to-dictionary parser
2012-12-19 15:26:19 -06:00
Dustin C. Hatch
d635e83431
Automatically create a Traverser instance if Application is given a root object
2012-11-30 22:47:06 -06:00
Dustin C. Hatch
f5f7e76dae
Added tests for Router's trailing slash handling options
2012-11-30 22:46:28 -06:00
Dustin C. Hatch
f14b744ef7
Added tests for Request.static_resource
2012-11-30 22:24:35 -06:00
Dustin C. Hatch
32e96f5807
Fixed more Python 3 import errors
...
--HG--
branch : py3k
2012-11-30 22:16:08 -06:00
Dustin C. Hatch
f8e89d46c6
Merge default into py3k
...
--HG--
branch : py3k
2012-11-30 22:11:23 -06:00
Dustin C. Hatch
c4e9397e8c
Replace Request.relative_url with Request.create_url and friends
2012-11-30 22:02:28 -06:00
Dustin C. Hatch
11271ebc31
app: Cleaned up imports and fixed Request.blank docstring
2012-11-30 22:01:25 -06:00
Dustin C. Hatch
47103b76a4
Add test for the milla.allow decorator
2012-11-30 21:17:16 -06:00
Dustin C. Hatch
91f2d954e7
test_app: Rename environ maker so nose doesn't think it is a test
2012-11-30 14:58:26 -06:00
Dustin C. Hatch
17cac57721
Clean up __before__ and __after__ handling and make it Python 3-compatible
...
--HG--
branch : py3k
2012-11-30 14:37:02 -06:00
Dustin C. Hatch
232bb17d6f
Fix test_app to run in Python 3
...
--HG--
branch : py3k
2012-11-30 14:16:57 -06:00
Dustin C. Hatch
dc79fea9db
Merged default into py3k
...
--HG--
branch : py3k
2012-11-30 13:19:55 -06:00
Dustin C. Hatch
5cd113ee46
Correctly use options_response for OPTIONS requests ( fixes #5 )
2012-11-30 13:13:17 -06:00
Dustin C. Hatch
0c7ebae8a9
Added tests for main Application logic
2012-11-30 13:09:13 -06:00
Dustin C. Hatch
5735d2b027
Better handling of string-type responses from controllers
...
--HG--
branch : py3k
2012-11-28 12:26:58 -06:00
Dustin C. Hatch
afcbf3d314
Get rid of unicode business in Permission objects
...
--HG--
branch : py3k
2012-11-28 12:26:36 -06:00
Dustin C. Hatch
a8a90294d2
Call str() instead of unicode() on Exceptions to get the message
...
--HG--
branch : py3k
2012-11-28 12:13:34 -06:00
Dustin C. Hatch
d2705ad18e
Better way to determine if a requirement is a Permission
...
--HG--
branch : py3k
2012-11-28 12:13:03 -06:00
hg
c721c7d06a
Merge default into py3k
...
--HG--
branch : py3k
2012-11-28 11:59:25 -06:00
hg
e36f17452e
Add tests for auth decorators
2012-11-28 11:54:54 -06:00
hg
fe54d0a666
Add a blank config dictionary to blank Requests
2012-11-28 11:54:41 -06:00
Dustin C. Hatch
a89e2396db
Added tests for the permissions framework
2012-11-27 23:08:35 -06:00
Dustin C. Hatch
aba45a2107
Merge default into py3k
...
--HG--
branch : py3k
2012-11-27 19:12:59 -06:00
Dustin C. Hatch
fbc58de27a
Started unit tests for the auth framework
2012-11-27 18:55:38 -06:00
Dustin C. Hatch
10e2ad803b
Bump PyDev interpreter and grammer for Python 3
...
--HG--
branch : py3k
2012-11-27 17:26:34 -06:00
Dustin C. Hatch
17e7486784
Change version in setup.py to 'py3k' to allow projects to require Milla==py3k
...
--HG--
branch : py3k
2012-11-19 22:34:44 -06:00
Dustin C. Hatch
eb347e7fb5
request: add a static_resource method to Request instances
2012-11-19 21:35:31 -06:00
Dustin C. Hatch
5529b66a57
Add Expires header to favicon controller responses
2012-11-19 17:30:13 -06:00
Dustin C. Hatch
dd05d95dba
Added http_date utility function
2012-11-19 17:29:04 -06:00
Dustin C. Hatch
b50ca751fb
Change version in setup.py to 'tip' to allow projects to require Milla==tip
2012-11-19 17:02:34 -06:00
Dustin C. Hatch
4c06340cea
Update URL Generator for compatibility with milla.Request and mark it deprecated
2012-11-03 19:04:26 -05:00
Dustin C. Hatch
2980b438da
Subclass WebOb Request and override relative_url (see #3 )
2012-11-03 19:03:13 -05:00
Dustin C. Hatch
fa97bd7b03
py3k: Handle non-callable controllers in routes better
...
--HG--
branch : py3k
2012-11-03 11:26:01 -05:00