viewcvs-web r141 - in trunk: . lib



Author: ovitters
Date: Mon Nov  3 13:15:21 2008
New Revision: 141
URL: http://svn.gnome.org/viewvc/viewcvs-web?rev=141&view=rev

Log:
	* lib/viewvc.py (view_roots_txt): Fix ?view=rootstxt view to follow
	upstream changes.



Modified:
   trunk/ChangeLog
   trunk/lib/viewvc.py

Modified: trunk/lib/viewvc.py
==============================================================================
--- trunk/lib/viewvc.py	(original)
+++ trunk/lib/viewvc.py	Mon Nov  3 13:15:21 2008
@@ -1632,7 +1632,7 @@
   """case insensitive comparison"""
   return cmp(string.lower(x), string.lower(y))
 
-def view_roots(request):
+def view_roots_txt(request):
   if 'roots' not in request.cfg.options.allowed_views:
     raise debug.ViewVCException('Root listing view is disabled',
                                 '403 Forbidden')
@@ -1655,11 +1655,32 @@
 
   data = common_template_data(request)
   data['roots'] = roots
-  generate_page(request, "roots", data)
+  generate_page(request, "rootstxt", data, 'text/plain')
+
+def view_roots(request):
+  if 'roots' not in request.cfg.options.allowed_views:
+    raise debug.ViewVCException('Root listing view is disabled',
+                                '403 Forbidden')
+  
+  # add in the roots for the selection
+  roots = []
+  expand_root_parents(request.cfg)
+  allroots = list_roots(request)
+  if len(allroots):
+    rootnames = allroots.keys()
+    rootnames.sort(icmp)
+    for rootname in rootnames:
+      href = request.get_url(view_func=view_directory,
+                             where='', pathtype=vclib.DIR,
+                             params={'root': rootname}, escape=1)
+      roots.append(_item(name=request.server.escape(rootname),
+                         type=allroots[rootname][1],
+                         path=allroots[rootname][0],
+                         href=href))
 
-def view_roots_txt(request):
   data = common_template_data(request)
-  generate_page(request, "rootstxt", data, 'text/plain')
+  data['roots'] = roots
+  generate_page(request, "roots", data)
 
 def view_directory(request):
   # For Subversion repositories, the revision acts as a weak validator for



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]