Commit Graph

32 Commits

Author SHA1 Message Date
Dan McGee
4a9b6867a3 Refactor common select_related into manager method
For a Package object query, we almost always did .select_related('arch',
'repo). Refactor this into the manager as a 'normal()' method so we can
avoid sprinkling the same logic everywhere.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 15:50:14 -05:00
Dan McGee
77842a6c76 Consolidate caching black magic
Get the stuff used to retrieve and refresh the latest date values all in
the same place, and make it a bit more beautiful by refactoring it all
into a common set of methods.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-07 17:03:13 -05:00
Dan McGee
01db07bad8 Use UTC datetime objects everywhere
Rather than the twisted mix of local times and UTC times we currently have.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-07 17:03:00 -05:00
Dan McGee
0d3e1eb796 Add a horrible hack to allow feed guid value to not be a permalink
Django, you make the simplest things so damn hard sometimes.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-07 17:01:31 -05:00
Dan McGee
9f4902f9c9 Ensure feed GUIDs are unchanging and unique
Implement 'tag:' style URIs for the GUID field on our RSS feeds. This
ensures new package updates show up as new, and we aren't jumping back
and forth between generated GUIDs having 'http://' and 'https://'
prefixes.

Much of the work here is to attempt to keep old news GUIDs constant so
we don't once again make everything show up as new in newsreaders.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-07 17:01:16 -05:00
Dan McGee
8c5358e888 Use date from model in news feed
Now that this a datetime and not just a date, we can use it directly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-15 13:51:11 -06:00
Dan McGee
14c8833cf0 Fix feeds for case-sensitive databases
This worked in MySQL because of it's case-insensitive matching, but does
not work in other databases unless we coerce the value.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-11-27 15:04:44 -06:00
Dan McGee
97d1e4164b Connect post_save signals where they will always be triggered
We need to do this in the models.py files, otherwise the post_save signal
might not be connected right away on launch of the application. Move them
over there, add a dispatch_uid so it only gets hooked up once, and do some
other function moving around so we don't have circular imports.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-13 18:11:28 -05:00
Dan McGee
16b27bc9e1 Fix potential race conditions in caching
Use a 'set to None' sentinel to indicate data updates are in progress and we
need to hold off a bit on caching a new value. This logic is gleamed from
the "Scaling Django" slides presented by Mike Malone and available freely on
SlideShare.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-08 17:09:34 -05:00
Dan McGee
f8c2a15510 Ensure last modified times use UTC
We were cheating before and using non-UTC times; adjust the values we get
back from the database as appropriate so our times are not bogus.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-07 19:57:31 -05:00
Dan McGee
fc6e7113c4 Store package feed last modified date in memcached
Just like what we did for news items, we can do the same for packages.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-07 19:52:31 -05:00
Dan McGee
b2acd5cb94 Store latest news date in memcached
This saves two database queries each request, meaning no database hits at
all if we are just going to return a 304 response. It also requires adding a
post_save signal to ensure our cache is updated with the correct latest news
date upon saving a news item.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-07 19:43:13 -05:00
Dan McGee
cf7bf2de29 Factor out common last modified code for news feed
This will set up retrieving this value from memcached as well as some other
changes to come.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-07 19:16:40 -05:00
Dan McGee
5dc5688d97 Improve request handling for feeds that haven't changed
By using the condition decorator (in a slightly odd way because these are
class-based views), we can cut down a lot on the response time for returning
304 status code for feeds that haven't changed. The decorator means we no
longer have to completely render the view to see if we can return a 304
status code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-14 17:42:12 -05:00
Dan McGee
04da5f03b2 Use arch.agnostic flag everywhere
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-08 11:12:43 -05:00
Dan McGee
f637a1eb67 Move news model to an appropriate place
Never would have guessed it should actually be in news/models.py.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-08 00:23:55 -05:00
Dan McGee
d57696c801 PyLint suggested cleanups
We had a bunch of extra imports, non-conventional variable names, spacing
issues, etc. that were relatively low-hanging fruit to clean up. Fix them
and make the code a bit cleaner in the process.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-28 11:41:19 -05:00
Dan McGee
1cfcf13e1b Remove an unnecessary iexact
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-27 16:10:48 -05:00
Dan McGee
89cae2bcb5 Update feeds to new 1.2 framework
Feeds are now views-based and don't need the dictionary anymore.
get_object() now takes named arguments as well making it a bit more
understandable when reading the code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-08 10:52:53 -05:00
Dan McGee
2b1256434c feeds: move link from method to attribute
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-04 10:03:00 -05:00
Dan McGee
d709604102 Remove archweb prefix from all imports
Unnecessary, and lets us standardize on not using it everywhere.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-02-10 00:29:27 -06:00
Dan McGee
6fe8aec0ab feeds: add per arch, per repo feed ability
Make the feed framework a lot more flexible and give the possibility to have
a feed for each architecture. You can drill down even more than also get a
feed for a particular repo; some might find this helpful for something like
tracking [testing]. Implements FS#12939.

I also bumped up the number of items available in each of these feeds; since
it is full of a bunch of small items it might be more helpful to have more
available and it should also prevent fewer ones from being missed.

The UI isn't exactly spectacular, but I figured some sort of page is better
than none listing all the various feeds you can pull from.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-02-04 19:03:32 -06:00
Dan McGee
cc93d3eda6 Make the feed titles more descriptive
FS#16752.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-31 15:36:42 -06:00
Dan McGee
f58b354a03 Use select_related() to make a few more places more performant
Especially when looking at packages, we always want the arch and repo.
Another big hunk of changes deals with the very inefficient signoffs code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-31 15:19:12 -06:00
Ismael Carnales
19f0a3fb57 added feeds from archweb_pub 2009-11-09 22:24:44 -02:00
eliott
67e2b65365 Removed feeds from devsite 2007-12-30 10:14:26 -08:00
eliott
3e297efad8 Massive retab fest.
Also added vim command comment to the end of files.
2007-12-29 16:42:55 -08:00
eliott
bd9a99d791 renamed imports 2007-12-22 16:21:21 -05:00
eliott
0f983356e2 Stupid change. 2007-11-17 13:30:23 -05:00
eliott
91dff97bfc Retab. 2007-11-06 20:43:41 -05:00
eliott
b358ee966b Fix bug FS#8417 2007-11-06 20:36:53 -05:00
eliott
39a548fd26 Initial import for public release...
Special Note
  Prior to git import, approx 90% of the code was done by Judd Vinet. Thanks Judd!
2007-11-03 03:45:10 -04:00