Janto Dreijer avatar Janto Dreijer committed 08111e2

changelog

Comments (0)

Files changed (4)

 		search_box_html = SearchPage.search_box()
 
 		# latest changes
+		show_latest_changes = 0
+		newest_packages_html = ""
+		if show_latest_changes:
+			## query pypi for changelog
+			## each has form (name, version, timestamp, action)
+			changes, expired = Cache.get("pypi_changelog")
+			if expired or changes is None:
+				server = xmlrpclib.ServerProxy('http://pypi.python.org/pypi', transport=GoogleXMLRPCTransport())
+				try:
+					new_changes = server.changelog(int(time.time() - SECONDS_IN_WEEK * 2)) #XXX GAE truncates the result, so it's unlikely we'll get a lot of results
+				except:
+					self.logger.warn("using old value for changelog lookup")
+				else:
+					if new_changes:
+						changes = new_changes
+						changes.sort(key=lambda c: (c[2], c[0]), reverse=True) # newest first
+						self.logger.info("%d items in changelog" % len(changes))
+						Cache.set("pypi_changelog", value=changes, duration=SECONDS_IN_MINUTE*30)
+			changes = changes if changes is not None else []
 
-		## query pypi for changelog
-		changes, expired = Cache.get("pypi_changelog")
-		if expired:
-			server = xmlrpclib.ServerProxy('http://pypi.python.org/pypi', transport=GoogleXMLRPCTransport())
-			new_changes = server.changelog(int(time.time() - SECONDS_IN_WEEK)) # changes made in last week
-			if new_changes:
-				Cache.set("pypi_changelog", value=new_changes, duration=SECONDS_IN_HOUR)
-			changes = new_changes
-		changes = changes if changes is not None else []
+			#~ changes = [c for c in changes if "scikit" in c[0].lower()] # filter changes relevant to scikits
+			self.logger.debug("%d items in changelog relevant to scikits" % len(changes))
 
-		changes = [c for c in changes if "scikit" in c[0].lower()] # filter changes relevant to scikits
-
-		## convert to html
-		max_items = 5
-		newest_packages_html = []
-		if changes:
-			newest_packages_html.append("<h3>News</h3>")
-			items = 0
-			for (name, version), g in groupby(sorted(changes), key=lambda c: (c[0], c[1])):
-				newest_packages_html.append('<a href="http://pypi.python.org/pypi/%(name)s">%(name)s</a>' % locals())
-				#~ newest_packages_html.append("<ul>")
-				#~ for n, v, timestamp, action in g:
-					#~ newest_packages_html.append("<li>%(action)s</li>" % locals())
-					#~ items += 1
-				#~ newest_packages_html.append("</ul>")
-				newest_packages_html.append("<br />")
-				items += 1
-				if max_items <= items:
-					break
-		newest_packages_html = "\n".join(newest_packages_html)
+			## convert to html
+			max_items = 5
+			newest_packages_html = []
+			if changes:
+				items = 0
+				newest_packages_html.append("<h3>Recent Changes</h3>")
+				# group together actions on same name (if contiguous)
+				for (name, version), g in groupby(changes, key=lambda c: (c[0], c[1])):
+					g = list(g)
+					g.sort(key=lambda c: c[2]) # show actions in order of application
+					actions = ", ".join(c[-1] for c in g)
+					version = version[:10] if version is not None else ""
+					newest_packages_html.append('<a href="http://pypi.python.org/pypi/%(name)s" title="%(actions)s">%(name)s %(version)s</a>' % locals())
+					newest_packages_html.append("<br />")
+					items += 1
+					if max_items <= items:
+						break
+			newest_packages_html = "\n".join(newest_packages_html)
 
 		# admin sidebar
 		admin_sidebar_html = ""
 		if users.is_current_user_admin():
 			admin_sidebar_html = """
-			<h3>Admin</h3>
-
-			"""
+			<h3><a href="/admin">Admin</a></h3>
+			<a href="%s">sign out</a>
+			""" % users.create_logout_url("/admin")
 
 		self.write(get_template("header") % locals())
 
 
 		self.print_footer()
 
+class RobotsPage(Page):
+	def get(self):
+		return
+
 application = webapp.WSGIApplication([
 	('/', MainPage),
 
 	('/search', SearchPage),
 	('/admin', AdminPage),
 	('/debug', DebugPage),
+	('/robots.txt', RobotsPage),
 
 	('/(.+)', PackageInfoPage),
 	], debug=True)

code/static/sphinxdoc.css

 div.body {
     margin: 0;
     padding: 0.5em 20px 20px 20px;
+    min-height: 300;
 }
 
 div.bodywrapper {

code/templates.py

 <h1>About SciKits</h1>
 
 <p>
-Scipy Toolkits are independent and seperately installable projects hosted under a common namespace. Packages that are distributed in this way are here (instead of in monolithic scipy) for at least one of three general reasons. Each of these reasons use the same high-level namespace (scikits).
+SciPy Toolkits are independent and seperately installable projects hosted under a common namespace. Packages that are distributed in this way are here (instead of in monolithic SciPy) for at least one of three general reasons. Each of these reasons use the same high-level namespace (scikits).
 <ol>
-<li> The package is deemed too specialized to live in scipy itself, but is targeted at the same community.
-<li> The package has a GPL (or similar) license which is too restrictive to live in scipy itself.
-<li> The package is meant for eventual inclusion in the scipy namespace but is being developed as a separately installed package. It is generally the responsibility of the package writer to push for inclusion into SciPy if that is the desire. However, some packages may be moved into SciPy by other interested SciPy developers after approval by the SciPy steering committee.
+<li> The package is deemed too specialized to live in SciPy itself, but is targeted at the same community.
+<li> The package has a GPL (or similar) license which is too restrictive to live in SciPy itself.
+<li> The package is meant for eventual inclusion in the SciPy namespace but is being developed as a separately installed package. It is generally the responsibility of the package writer to push for inclusion into SciPy if that is the desire. However, some packages may be moved into SciPy by other interested SciPy developers after approval by the SciPy steering committee.
 </ol>
 </p>
 
 <h3>Add your own package</h3>
 
 <p>
-<a href="http://scipy.org/scipy/scikits/">SciKits developer resources</a>
+<a href="http://www.scipy.org/scipy/scikits/">SciKits developer resources</a>
 </p>
 
 <p>
 			msg = 'Failed to fetch %s' % url
 			raise
 
+		if response.content_was_truncated:
+			logger.warn("GAE truncated xmlrpc data")
+
 		if response.status_code != 200:
 			logger.error('%s returned status code %s' % (url, response.status_code))
 			raise xmlrpclib.ProtocolError(host + handler,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.