Fixed errors when submitting (Github api sends tuples for commit parents now) + Fixed error when editing (session entry for modified and deleted categories didn't initialize properly) + added back links to workshop page on discussion list and changeset list
authordurandn
Tue, 24 Mar 2015 13:12:59 +0100
changeset 56 ae469e83026f
parent 55 53ee5113af74
child 57 b7a74d8d5291
Fixed errors when submitting (Github api sends tuples for commit parents now) + Fixed error when editing (session entry for modified and deleted categories didn't initialize properly) + added back links to workshop page on discussion list and changeset list
src/catedit/persistence.py
src/catedit/templates/categories/editor.html
src/catedit/templates/categories/submit.html
src/catedit/templates/categories/workshop.html
src/catedit/templates/social/changesets_index.html
src/catedit/templates/social/comment_thread_layout.html
src/catedit/templates/social/discussions_index.html
src/catedit/views/home.py
--- a/src/catedit/persistence.py	Mon Mar 23 16:09:30 2015 +0100
+++ b/src/catedit/persistence.py	Tue Mar 24 13:12:59 2015 +0100
@@ -403,11 +403,12 @@
                 + str(new_tree_data)
             )
             logger.error(ghe.response.text)
-
+        logger.debug(str(new_tree_response[0]["sha"]))
+        
         # Point 5
         new_commit_data = {"message": kwargs["message"],
                            "parents": [last_commit_master["sha"]],
-                           "tree": new_tree_response["sha"]}
+                           "tree": new_tree_response[0]["sha"]}
         logger.debug(str(new_commit_data))
         try:
             new_commit = github.post(
@@ -427,7 +428,7 @@
             logger.error(ghe.response.text)
 
         # Point 6
-        new_head_data = {"sha": new_commit["sha"], "force": "true"}
+        new_head_data = {"sha": new_commit[0]["sha"], "force": "true"}
         logger.debug(str(new_head_data))
         try:
             new_head = github.patch(
--- a/src/catedit/templates/categories/editor.html	Mon Mar 23 16:09:30 2015 +0100
+++ b/src/catedit/templates/categories/editor.html	Tue Mar 24 13:12:59 2015 +0100
@@ -12,7 +12,7 @@
   {{ super() }}
   {% if session.get("user_logged", None) %}
     <li><a class="navbar-decorative">></a></li>
-    <li><a href="{{ url_for('categories.workshop', repository=current_repository) }}">Atelier</a></li>
+    <li><a href="{{ url_for('categories.workshop', repository=current_repository) }}">{{current_repository}}</a></li>
     <li><a class="navbar-decorative">></a></li>
     <li class="active"><a>Editeur</a></li>
   {% endif %}
--- a/src/catedit/templates/categories/submit.html	Mon Mar 23 16:09:30 2015 +0100
+++ b/src/catedit/templates/categories/submit.html	Tue Mar 24 13:12:59 2015 +0100
@@ -34,7 +34,7 @@
   {{ super() }}
   {% if session.get("user_logged", None) %}
   <li><a class="navbar-decorative">></a></li>
-  <li><a href="{{ url_for('categories.workshop', repository=current_repository) }}">Atelier</a></li>
+  <li><a href="{{ url_for('categories.workshop', repository=current_repository) }}">{{current_repository}}</a></li>
   <li><a class="navbar-decorative">></a></li>
   <li class="active"><a>Soumission</a></li>
   {% endif %}
--- a/src/catedit/templates/categories/workshop.html	Mon Mar 23 16:09:30 2015 +0100
+++ b/src/catedit/templates/categories/workshop.html	Tue Mar 24 13:12:59 2015 +0100
@@ -34,7 +34,7 @@
   {{ super() }}
   {% if session.get("user_logged", None) %}
     <li><a class="navbar-decorative">></a></li>
-    <li class="active"><a>Atelier</a></li>
+    <li class="active"><a>{{current_repository}}</a></li>
   {% endif %}
 {% endblock navbar_items %}
 {% block repo_list %}
--- a/src/catedit/templates/social/changesets_index.html	Mon Mar 23 16:09:30 2015 +0100
+++ b/src/catedit/templates/social/changesets_index.html	Tue Mar 24 13:12:59 2015 +0100
@@ -62,7 +62,10 @@
       {% endfor %}
     {% endif %}
     <tr>
-      <td class="text-right" colspan = "5">
+      <td>
+      	<a href="{{url_for('categories.workshop', repository=current_repository)}}" class="btn btn-default">Retour</a>
+      </td>
+      <td class="text-right" colspan = "4">
         {% import "macros.html" as macros %}
         {{ macros.render_pagination(commits_pagination, commits_per_page, page_arg_name="commits_page", per_page_arg_name="commits_per_page") }}
       </td>
--- a/src/catedit/templates/social/comment_thread_layout.html	Mon Mar 23 16:09:30 2015 +0100
+++ b/src/catedit/templates/social/comment_thread_layout.html	Tue Mar 24 13:12:59 2015 +0100
@@ -7,7 +7,7 @@
   {{ super() }}
   {% if session.get("user_logged", None) %}
     <li><a class="navbar-decorative">></a></li>
-    <li><a href="{{ url_for('categories.workshop', repository=current_repository) }}">Atelier</a></li>
+    <li><a href="{{ url_for('categories.workshop', repository=current_repository) }}">{{current_repository}}</a></li>
   {% endif %}
 {% endblock navbar_items %}
 {% block page_content %}
--- a/src/catedit/templates/social/discussions_index.html	Mon Mar 23 16:09:30 2015 +0100
+++ b/src/catedit/templates/social/discussions_index.html	Tue Mar 24 13:12:59 2015 +0100
@@ -68,7 +68,10 @@
       </tr>
     {% endfor %}
     <tr>
-      <td class="text-right" colspan = "6">
+   	  <td>
+      	<a href="{{url_for('categories.workshop', repository=current_repository)}}" class="btn btn-default">Retour</a>
+      </td>
+      <td class="text-right" colspan = "5">
         {% import "macros.html" as macros %}
         {{ macros.render_pagination(discussions_pagination, discussions_per_page, page_arg_name="discussions_page", per_page_arg_name="discussions_per_page") }}
       </td>
--- a/src/catedit/views/home.py	Mon Mar 23 16:09:30 2015 +0100
+++ b/src/catedit/views/home.py	Tue Mar 24 13:12:59 2015 +0100
@@ -86,6 +86,15 @@
             + session["user_login"]
         )
         logger.error(ghe.response.text)
+    
+    session["modified_categories"] = {
+        repo: {} for
+        repo in app.config["PERSISTENCE_CONFIG"]["REPOSITORY_LIST"]
+    }
+    session["deleted_categories"] = {
+        repo: {} for repo
+        in app.config["PERSISTENCE_CONFIG"]["REPOSITORY_LIST"]
+    }
     return redirect(url_for('home.index'))