create per-project subdirs, so that one product can be in multiple projects

Change-Id: I48ddf7be1fb034fc7f51a5bc4ee311159f15d562
diff --git a/siterender.py b/siterender.py
index 315f8df..3ce209c 100644
--- a/siterender.py
+++ b/siterender.py
@@ -205,31 +205,34 @@
     # init list of projects
     projects = {}
 
-    # list of products
-    prodfiles = os.listdir(args.product_dir)
+    # list of projects
+    projdirs = os.listdir(args.product_dir)
 
-    for prodfile in prodfiles:
+    for projdir in projdirs:
+        prodfiles = os.listdir("%s/%s" % (args.product_dir, projdir))
 
-        # load product, and set buildtime
-        logger.debug("loading file file: '%s'", prodfile)
-        product = json_file_load("%s/%s" % (args.product_dir, prodfile))
-        product.update({"buildtime": buildtime})
+        for prodfile in prodfiles:
 
-        projname = product["onf_project"]
+            # load product, and set buildtime
+            logger.debug("loading file file: '%s'", prodfile)
+            product = json_file_load("%s/%s/%s" % (args.product_dir, projdir, prodfile))
+            product.update({"buildtime": buildtime})
 
-        # build product filename, write out template
-        site_prod_filename = "%s/%s/%s/index.html" % (
-            args.site_dir,
-            projname,
-            clean_name(product["product_name"]),
-        )
-        render_to_file(j2env, product, "product.html", site_prod_filename)
+            projname = product["onf_project"]
 
-        # product to project list
-        if projname not in projects:
-            projects[projname] = [product]
-        else:
-            projects[projname].append(product)
+            # build product filename, write out template
+            site_prod_filename = "%s/%s/%s/index.html" % (
+                args.site_dir,
+                projname,
+                clean_name(product["product_name"]),
+            )
+            render_to_file(j2env, product, "product.html", site_prod_filename)
+
+            # product to project list
+            if projname not in projects:
+                projects[projname] = [product]
+            else:
+                projects[projname].append(product)
 
     # list of projects
     for projname in sorted(projects.keys()):