|
|
mads
|
4f0de9468da3
|
5 years ago
|
|
controllers: move controllers base class from lib/base to controllers
TG quickstart put it in lib/base.py , but it fits better on the controllers layer as a base there.
The contributing docs were a bit ahead of time ... but with a typo.
|
|
|
mads
|
67e5b90801aa
|
5 years ago
|
|
lib: move webhelpers2 and friends to webutils
Gives less of the unfortunate use of helpers - especially in low level libs.
|
|
|
mads
|
216ed3859869
|
5 years ago
|
|
|
|
|
mads
|
5e46f73f0d1c
|
5 years ago
|
|
|
|
|
mads
|
b095e2fbba44
|
5 years ago
|
|
|
|
|
mads
|
0be48652ca48
|
5 years ago
|
|
routing: separate url handling from routing - move it to webutils
This is a helper method relying on the thread local tg.request. We didn't have a good place to put it. Now we do.
This (re)moves unfortunate dependencies to the routing module (which almost is a controller).
|
|
|
mads
|
3ccb302bb551
|
5 years ago
|
|
|
|
|
mads
|
08eec03c9485
|
6 years ago
|
|
|
|
|
mads
|
e35373106528
|
6 years ago
|
|
py3: remove safe_unicode in places where it no longer is needed because all strings (except bytes) already *are* unicode strings
(The remaining safe_unicode calls are still needed and can't just be removed, generally because we in these cases still have to convert from bytes to unicode strings.)
|
|
|
mads
|
9203621cae03
|
6 years ago
|
|
vcs: always return bytes from node.content
We will rather have the unicode conversions explicit.
Note: Py3 bytes doesn't have .startswith - replace that with a regexp.
|
|
|
mads
|
2a6b6baf1448
|
6 years ago
|
|
page: pass url query params to Page instead of passing request.GET.mixed() to .pager
Standardize on one transparent way to use Pager:
Avoid passing random parameters to .pager() ... or any parameters at all.
|
|
|
mads
|
fe4086096758
|
7 years ago
|
|
|
|
|
mads
|
0a277465fddf
|
7 years ago
|
|
|
|
|
mads
|
16df4993b442
|
7 years ago
|
|
scm: don't try to get IP address from web request in model
Remove a layering violation and make functions more reusable when they no longer depend on global state.
At this level, the IP address (and information about the current user) is only used for hooks logging push / pull operations. Arguably, IP address logging only belongs in an HTTP access log, not in the log of push/pull operations. But as long as we have IP addresses in the logs, we have to provide it. The (good?) alternative would be to drop IP address from the push / pull logs ...
|
|
|
mads
|
aa25ef34ebab
|
8 years ago
|
|
auth: refactor to introduce @LoginRequired(allow_default_user=True) and deprecate @NotAnonymous() It was error prone that @LoginRequired defaulted to allow anonymous users (if 'default' user is enabled). See also 245b4e3abf39. Refactor code to make it more explicit and safe by default: Deprecate @NotAnonymous by making it the default of @LoginRequired. That will make it safe by default. To preserve same functionality, set allow_default_user=True in all the cases where @LoginRequired was *not* followed by @NotAnonymous or other permission checks - that was done with some script hacks: sed -i 's/ @LoginRequired(\(..*\))/ @LoginRequired(\1, allow_default_user=True)/g' `hg mani` sed -i 's/ @LoginRequired()/ @LoginRequired(allow_default_user=True)/g' `hg mani` perl -0pi -e 's/\ @LoginRequired\(allow_default_user=True\)\n\s*\ @NotAnonymous\(\)/\ @LoginRequired()/g' `hg mani` perl -0pi -e 's/\ @LoginRequired\(allow_default_user=True\)(\n\s*\ @Has(Repo)?Permission)/\ @LoginRequired()\1/g' `hg mani` It has been reviewed that all uses of allow_default_user=True are in places where the there indeed wasn't any checking for default user before. These may or may not be correct, but now they are explicit and can be spotted and fixed. The few remaining uses of @NotAnonymous should probably be removed somehow.
|
|
|
Lars Kruse
|
7691290837d2
|
9 years ago
|
|
codingstyle: trivial whitespace fixes
Reported by flake8.
|
|
|
mads
|
e9ac5698281d
|
9 years ago
|
|
tg: minimize future diff by some mocking and replacing some pylons imports with tg
No actual tg dependency yet, just a temporary hack faking tg as an alias for pylons.
Based on work by Alessandro Molina.
|
|
|
Søren Løvborg
|
a7271dbefd96
|
9 years ago
|
|
|
|
|
mads
|
3dcf1f82311a
|
9 years ago
|
|
controllers: avoid setting request state in controller instances - set it in the thread global request variable
In TurboGears, controllers are singletons and we should avoid using instance variables for any volatile data. Instead, use the "global thread local" request context.
With everything in request, some use of c is dropped.
Note: kallithea/controllers/api/__init__.py still use instance variables that will cause problems with TurboGears.
|
|
|
Thomas De Schampheleire
|
0122959e1f1d
|
9 years ago
|
|
lib: move jsonify from utils to base
Suggested by Mads Kiilerich.
The jsonify method is the only thing in utils that directly uses pylons. Move it to base where it fits better and we can use existing global imports.
|
|
|
Søren Løvborg
|
296581686f02
|
9 years ago
|
|
db: rename Gist.gist_owner to Gist.owner_id
For consistency with the existing "owner" relationship.
|
|
|
Thomas De Schampheleire
|
e33b17db388d
|
9 years ago
|
|
helpers: move Page/RepoPage to a separate file page.py
The Page and RepoPage classes are not used from templates and thus do not belong in helpers. They could have been put in utils.py, but because they are completely standalone we can easily split them to a separate file.
|
|
|
Thomas De Schampheleire
|
af3539a458f6
|
9 years ago
|
|
Turbogears2 migration: replace pylons.url by kallithea.config.routing.url
In preparation for the migration to Turbogears2, introduce a kallithea.config.routing.url to replace pylons.url. The implementation is basically the same: wrap around routes.url().
This change involves: - a number of import statement changes - fixing some tests in test_libs.py; to avoid duplication, the different implementations of fake_url were grouped in one place.
This change was first proposed by Alessandro Molina in his initial port. Following changes were made afterwards: - move UrlGenerator from kallithea.lib.utils to kallithea.config.routing - add documentation to UrlGenerator - kallithea/lib/auth.py used url_for instead of url, for no apparent reason so this was changed. - fix libs tests - rebase onto Pylons-based Kallithea first
|
|
|
Mads Kiilerich
|
32b674ab4878
|
10 years ago
|
|
|
|
|
Mads Kiilerich
|
c0a3519e7d2c
|
10 years ago
|
|
controllers: remove pointless comments
These comments are mostly trivial and sometimes wrong. We don't want to maintain or pretend we do.
|
|
|
Mads Kiilerich
|
fb64046d02c2
|
10 years ago
|
|
controllers: simplify request.GET.get for safe_int
Don't specify the default value twice - the one for safe_int is enough.
|
|
|
Mads Kiilerich
|
edb24bc0f71a
|
10 years ago
|
|
|
|
|
Mads Kiilerich
|
87aef0cb5a6a
|
10 years ago
|
|
|
|
|
Takumi IINO
|
7425088bc4ff
|
10 years ago
|
|
|
|
|
Søren Løvborg
|
ba30adf2fb8a
|
10 years ago
|
|
auth: introduce AuthUser.is_default_user attribute
This makes makes a number of checks more readable.
The username of the default user is presently hardcoded to "default" (in db.User.DEFAULT_USER); this is currently what defines the default user, and this commit doesn't change that. (Even if the check that defines is_default_user is a comparison between user IDs and not usernames, the anonymous_user object used in the comparison is loaded by looking up the user named "default".)
|
|
|
Søren Løvborg
|
d9b78d8f1db3
|
10 years ago
|
|
cleanup: replace redirect with WebOb exceptions
All redirect does is to log "Generating 302 redirect" with logging the actual location and raise a WebOb HTTPFound exception, and the logging is redundant, as WebOb exceptions and their status codes are already logged.
Instead, just raise the exception directly, which is both explicit and simpler (and finally, gets rid of "return redirect" which never really returns).
|
|
|
Mads Kiilerich
|
0ad053c172fa
|
11 years ago
|
|
cleanup: make module self-naming consistent
The self naming is quite pointless ... but at least make it right.
|
|
|
Mads Kiilerich
|
0210d0b769d4
|
11 years ago
|
|
|
|
|
Mads Kiilerich
|
d69aa464f373
|
11 years ago
|
|
cleanup: consistently use 'except ... as ...:'
Use the Python 2.6+ syntax instead of the old confusing 'except ..., ...' syntax.
|
|
|
Mads Kiilerich
|
86b1f3cfe836
|
11 years ago
|
|
spelling: fix title casing on various translated strings
Primarily captions on other not-just-text and data.
|
|
|
Mads Kiilerich
|
c04c2734e32f
|
11 years ago
|
|
controllers: consistently use formfill.render with force_defaults=False
The inconsistency could cause confusion for developers. It seems to me like force_defaults=False should be the default ... and apparently it was that in older versions of formfill.
It could perhaps make sense for us to have a wrapper that added the defualt values once, instead of repeating it all over ;-)
|
|
|
Mads Kiilerich
|
6a4f13866fe6
|
11 years ago
|
|
|
|
|
Thomas De Schampheleire
|
0bc8975f5365
|
11 years ago
|
|
|
|
|
Mads Kiilerich
|
d51a6f5e57d1
|
12 years ago
|
|
|
|
|
Bradley M. Kuhn
|
24c0d584ba86
|
12 years ago
|
|
|
|
|
Bradley M. Kuhn
|
1948ede028ef
|
12 years ago
|
|
|
|
|
Bradley M. Kuhn
|
ad38f9f93b3b
|
12 years ago
|
|
Correct licensing information in individual files.
The top-level license file is now LICENSE.md.
Also, in various places where there should have been joint copyright holders listed, a single copyright holder was listed. It does not appear easy to add a link to a large list of copyright holders in these places, so it simply refers to the fact that various authors hold copyright.
In future, if an easy method is discovered to link to a list from those places, we should do so.
Finally, text is added to LICENSE.md to point to where the full list of copyright holders is, and that Kallithea as a whole is GPLv3'd.
|
|
|
Bradley M. Kuhn
|
d208416c84c6
|
12 years ago
|
|
|
|
|
Bradley M. Kuhn
|
d1addaf7a91e
|
12 years ago
|
|
Second step in two-part process to rename directories. This is the actual directory rename.
|