Commit Graph

380 Commits

Author SHA1 Message Date
Angel Velásquez
b788beeeb0 Merge pull request #57 from jelly/small_fixes
Make pylint scan all module directory's
2017-10-18 11:48:40 -04:00
Giancarlo Razzolini
06aedb9579
packages/admin: Fix the syntax for queryset
Django 1.7 changed the method name to get_queryset.
2017-09-01 11:47:59 -03:00
Jelle van der Waa
baec4f54b3 pylint: add deprecated module check
Remove deprecated import of cgi for parse_qs
2017-08-28 21:16:05 +02:00
Jelle van der Waa
8dbaef2e42 packages.tests: remove unused imports 2017-07-11 21:56:30 +02:00
Jelle van der Waa
74c21479f6 packages_extra: remove unused variable tagname 2017-07-11 21:42:36 +02:00
Jelle van der Waa
c123263330 packages; dict.has_key is deprecated 2017-06-30 17:04:58 +02:00
Angel Velásquez
cb80360a23 Merge pull request #30 from jelly/signoffs
Signoffs
2017-06-12 14:27:41 -04:00
Jelle van der Waa
22acfa3391 tests: add tests for sitemaps 2017-06-11 20:54:21 +02:00
Jelle van der Waa
7a6bfc7441 tests: test feed 2017-06-11 18:43:14 +02:00
Jelle van der Waa
273c27adea Change signoff permissions for Testers group
Change the permissions required for a signoff, so that the testers group
does not need change_package permission

Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
2017-06-05 22:10:51 +02:00
Jelle van der Waa
3d1a8302ba Make print statements Python 3 compatible 2017-05-28 16:45:06 +02:00
Jelle van der Waa
a215f25efa releng: Fix django warnings
Fixes warnings for releng.Test.modules and releng.Test.rollback_modules
(fields.W340) null has no effect on ManyToManyField.
2017-05-24 09:06:28 +02:00
Jelle van der Waa
21c2d1a0de Remove unused jinja2.py 2017-05-02 21:13:56 +02:00
Angel Velasquez
49828ba2cb Add missing migration from ad0bddb209
Signed-off-by: Angel Velasquez <angvp@archlinux.org>
2016-07-31 05:57:15 +00:00
Jelle van der Waa
ad0bddb209 Fix typo in known_bad help text
Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
Signed-off-by: Angel Velasquez <angvp@archlinux.org>
2016-07-31 05:43:09 +00:00
Dan McGee
c12060e51b Handle Django's level 3 verbosity properly
Signed-off-by: Dan McGee <dan@archlinux.org>
2015-06-18 16:31:09 -05:00
Dan McGee
becb5b2356 Fix error in test where HTTP_HOST doesn't exist
Signed-off-by: Dan McGee <dan@archlinux.org>
2015-04-15 17:23:18 -05:00
Dan McGee
7d4a6db69f Don't blow up if we can't fetch an SVN revision
Signed-off-by: Dan McGee <dan@archlinux.org>
2015-04-15 12:34:20 -05:00
Dan McGee
94d1c96ac9 Ensure packager=unknown query works as expected
I broke this in commit dca00e7aab, whoops!

Signed-off-by: Dan McGee <dan@archlinux.org>
2015-01-29 20:16:37 -06:00
Dan McGee
dca00e7aab Filter maintainer list on packages page by allowed repos
We do this elsewhere on the master keys page, so do the same thing here.

Noticed-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2014-12-02 14:57:03 -06:00
Dan McGee
eb7172cd4d Convert some of URL details to Jinja2
Anytime we have a loop with >100 items, the Django template engine
begins to be the bottleneck. This one is relatively straightforward to
convert, and sets the stage for converting the mirror status page as
well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2014-11-08 13:43:59 -06:00
Dan McGee
7c46d07f64 Use varied prime numbers for caching lengths
Signed-off-by: Dan McGee <dan@archlinux.org>
2014-10-19 18:12:58 -05:00
Dan McGee
32a0075b59 Merge branch 'jinja' 2014-10-18 19:31:17 -05:00
Dan McGee
061805aa73 FS#30773: put exact matches at top
There have been a few proposed solutions to this, but there really isn't
anything without a drawback. Things break pagination, require loading
the entire result set from the database, etc.

Just plop a new table on the page if someone did a so-called "simple"
search and we have a match. Only show on the first page of the search
results. This results in a relatively fast experience for someone doing
something like searching for the "perl" package.

Signed-off-by: Dan McGee <dan@archlinux.org>
2014-10-18 18:28:26 -05:00
Dan McGee
0e90423fc0 Add possible optimization as a TODO for later 2014-10-18 17:25:21 -05:00
Dan McGee
122302e9e5 Move maintainer/packager link code back into template
Signed-off-by: Dan McGee <dan@archlinux.org>
2014-10-18 15:36:56 -05:00
Dan McGee
e5e5632fb3 Break out Jinja2-specific template helpers
Signed-off-by: Dan McGee <dan@archlinux.org>
2014-10-18 15:25:30 -05:00
Dan McGee
fff9cf9c55 Convert bulk of package details page to Jinja2
We wrap the whole thing in a Django template so we don't have to convert
our base template to Jinja2 (or have one for each templating engine).
This also simplifies the static stuff so we can just keep using the
Django tags.

Signed-off-by: Dan McGee <dan@archlinux.org>
2014-10-18 15:18:02 -05:00
Dan McGee
2f19529c92 Convert details sub-tempates to Jinja2
This is a start at improving performance of rendering the package
details page, our most-visited and slowest page on the production
website. The Django template system is not very efficient due to our
heavy use of broken out templates and pulling of various attributes and
such on related packages.

Signed-off-by: Dan McGee <dan@archlinux.org>
2014-10-18 13:48:07 -05:00
Dan McGee
9d0db65025 Fix up some IP address field issues
Ensure we always coerce values to unicode in our __unicode__ method, and
remove some now unneeded verbosity and comments since the upstream bug
has been fixed.

Signed-off-by: Dan McGee <dan@archlinux.org>
2014-09-01 18:26:05 -05:00
Dan McGee
28d486870d More changes for move to Django 1.7
The removal of the root `__init__.py` file is so the testing framework
does consistent imports of our models now that the loading strategy has
changed.

Signed-off-by: Dan McGee <dan@archlinux.org>
2014-09-01 18:26:05 -05:00
Dan McGee
0896b5697a Add auto-generated migrations from new Django migrations framework
Signed-off-by: Dan McGee <dan@archlinux.org>
2014-09-01 18:26:05 -05:00
Dan McGee
51d90e23c9 Remove old south migrations
Django 1.7 has built-in migrations support, so we no longer want these
around. All existing installs should be fully migrated at this point to
the latest schema.

Signed-off-by: Dan McGee <dan@archlinux.org>
2014-09-01 18:26:05 -05:00
Dan McGee
3faeab7d54 Add 'Latest Update' column to stale package relations
This helps when doing the irregular cleanup of these things and making
sure a relation has been stale for some time and not just a couple
minutes or hours.

Signed-off-by: Dan McGee <dan@archlinux.org>
2014-01-25 09:16:48 -06:00
Dan McGee
429736f7e9 Remove date_hierarchy from several package admin views
I was never using this and it adds some pretty substantial overhead to
each render of the admin page, so toss it. Add the simple date filter to
the sidebar instead.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-11-27 17:05:02 -05:00
Dan McGee
58356ec5b3 Allow pkg_details_link to honor package flag state
This allows the tag to be used in a few more places we weren't already
able to use it, and hopefully speeds up rendering a tad on the package
differences page.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-11-27 16:07:49 -05:00
Dan McGee
ee6002c911 Django 1.6 upgrade, deprecation cleanup
PendingDeprecationWarning: commit_on_success is deprecated in favor of atomic.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-11-06 21:17:27 -06:00
Dan McGee
d54df175a8 Django 1.6 upgrade, deprecation cleanup
PendingDeprecationWarning: `queryset` method should be renamed `get_queryset`

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-11-06 20:55:48 -06:00
Dan McGee
ac1c00ee86 When retrieving signoff specs, select the arch object as well
Otherwise we do one query per row in the signoff table to fetch the
architecture and it's required_signoffs value, which is less than ideal.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-23 09:29:40 -05:00
Dan McGee
6fa6a8db07 Use required_signoffs value when creating signoff specs
And respect it elsewhere when we create a fake default specification
because a real one does not exist yet.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-22 10:50:03 -05:00
Dan McGee
bb18fa3323 Fix parsing issues when query string keys contain unicode
This is dirty, but it works. There is probably a better and cleaner way
to do all of this, but for now just fix it quickly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-20 13:32:09 -05:00
Dan McGee
b7b2474064 Various minor code cleanups and fixes
Most of these were suggested by PyCharm, and include everything from
little syntax issues and other bad smells to dead or bad code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-16 22:12:01 -05:00
Dan McGee
31d39e75ee Add shortcut for HEAD requests on slower views
We sometimes see some web bots and crawlers make HEAD requests to verify
existence of certain pages in the application. However, they are less
than kind as 20-50 requests might arrive at the same time, and package
search and details pages are some of the slowest rendering pages we have
due to the Django template engine.

Rather than waste time generating the content only to throw it away,
response as soon as we can with either a 404 or 200 response as
appropriate, omitting the 'Content-Length' header completely, which
seems to be acceptable by the HTTP spec.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-16 21:59:32 -05:00
Dan McGee
283cd944be Use require_safe decorator rather than require_GET
This was added in Django 1.4, and ensures both GET and HEAD requests,
but not POST requests, are allowed through.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-16 20:16:06 -05:00
Dan McGee
4d7d08f93d Fix missing attribute error in replacment find code
Whoops. Just introduced this when ensuring we look for both the packgae
in other repositories as well as any replacments.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-14 13:45:00 -05:00
Dan McGee
7fc8da7d95 Show replacments for package if it has been removed
This covers the case where we can't find the package in any other
repositories, but it was removed recently enough that we have a found
package update object.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-13 13:05:02 -05:00
Dan McGee
f2a6316be0 Add additional pg_trgm indexes for quicker searches
This allows our normal keyword-based search to be index-optimized rather
than always doing full table scans. It requires the pg_trgm extension
which is shipped out of the box with any sane install of PostgreSQL.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-13 11:57:55 -05:00
Dan McGee
1f2a6384f3 Remove function caching in packages/utils
We don't see these called enough to make caching the data worth it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-03-11 21:25:27 -05:00
Dan McGee
dd0ecfaeac Use user.userprofile rather than user.get_profile()
The get_profile() function is deprecated as of Django 1.5.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-26 19:51:40 -06:00
Dan McGee
ddcba11177 Fix ALPM unittest to run when ALPM isn't present
This gets some proper unittest skip decorator action now in addition to
adding more testing around everything.

Signed-off-by: Dan McGee <dan@archlinux.org>
2013-02-26 19:06:51 -06:00