Fixed nested resources in api-python-client-doc
diff --git a/apiclient/discovery.py b/apiclient/discovery.py
index 3084810..a5b7c9a 100644
--- a/apiclient/discovery.py
+++ b/apiclient/discovery.py
@@ -168,6 +168,7 @@
           methodName, self._developerKey, methodDesc, futureDesc)
 
     setattr(method, '__doc__', 'A description of how to use this function')
+    setattr(method, '__is_resource__', True)
     setattr(theclass, methodName, method)
 
   for methodName, methodDesc in resources.iteritems():
@@ -328,6 +329,7 @@
             methodName, self._developerKey, methodDesc, futureDesc)
 
       setattr(method, '__doc__', 'A description of how to use this function')
+      setattr(method, '__is_resource__', True)
       setattr(theclass, methodName, method)
 
     for methodName, methodDesc in resourceDesc['resources'].iteritems():
diff --git a/samples/api-python-client-doc/main.py b/samples/api-python-client-doc/main.py
index ae87b3e..9af42ad 100755
--- a/samples/api-python-client-doc/main.py
+++ b/samples/api-python-client-doc/main.py
@@ -90,7 +90,24 @@
 
   def get(self, service_name, version, collection):
     service = build(service_name, version)
-    page = "<p><a href='/'>Home</a></p><pre>%s</pre>" % pydoc.plain(render_doc(getattr(service, collection)()))
+    # descend the object path
+    path = collection.split("/")
+    if path:
+      for method in path[:-1]:
+        service = getattr(service, method)()
+    method = getattr(service, path[-1])
+    obj = method()
+    page = "<p><a href='/'>Home</a></p><pre>%s</pre>" % pydoc.plain(render_doc(obj))
+
+    if hasattr(method, '__is_resource__'):
+      collections = []
+      for name in dir(obj):
+        if not "_" in name and callable(getattr(obj, name)) and hasattr(getattr(obj, name), '__is_resource__'):
+          collections.append(name)
+
+      for name in collections:
+        page = re.sub('(%s) =' % name, r'<a href="/%s/%s/%s">\1</a> =' % (service_name, version, collection + "/" + name), page)
+
     self.response.out.write(page)
 
 
@@ -99,7 +116,7 @@
       [
       (r'/', MainHandler),
       (r'/(\w*)/(\w*)', ServiceHandler),
-      (r'/(\w*)/(\w*)/(\w*)', CollectionHandler),
+      (r'/(\w*)/(\w*)/(.*)', CollectionHandler),
       ],
       debug=True)
   util.run_wsgi_app(application)