Commit 30a48484 authored by Louis's avatar Louis
Browse files

If no package is asked, get 10 random packages among the 1000 top packages

parent 5a4f4089
- if no pkg nor user: random 10 packages
......@@ -6,6 +6,7 @@ import datetime
import itertools
import jinja2
import pkg_resources
import random
import slumber
import sys
import urllib
......@@ -20,7 +21,10 @@ _client = xmlrpclib.ServerProxy("")
class PackageList:
def __init__(self, user=None, pkg=None):
self.packages = {}
for name in sorted(self._get_packages(user, pkg)):
package_list = list(self._get_packages(user, pkg))
if not package_list:
package_list = random.sample([package for package, _ in _client.top_packages(1000)], 10)
for name in sorted(package_list):
self.packages[name] = Package(name)
except ValueError:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment