]> khamidou — GitHub mirrors - kite.git/commitdiff
fixed a couple server bugs
authorkarim hamidou <khamidou@gmail.com>
Thu, 1 May 2014 12:30:59 +0000 (14:30 +0200)
committerkarim hamidou <khamidou@gmail.com>
Thu, 1 May 2014 12:30:59 +0000 (14:30 +0200)
src/back/kite/filterdaemon.py
src/back/kite/jsonfile.py
src/back/kite/server.py
src/front/app/js/controllers.js

index 47aeabc0924cdb59372edb240012175d405a274f..b9ece95dd0b2d6024923f64eb7affdbac107aba3 100755 (executable)
@@ -123,6 +123,7 @@ class ProcessorThread(threading.Thread):
                 if event["type"] == "create":
                     try:
                         username = users.get_username_from_folder(event["path"]) 
+                        print "username: %s, path: %s\n" % (username, event["path"])
 
                         if username not in self.threads_index_cache:
                             threads_index = users.get_user_threads_index(event["path"])
index ecc6c4ff59dc91cd66595f36b02944db72170d37..ac296973ec240708e3019f26bc89b692ba1ab877 100644 (file)
@@ -30,14 +30,11 @@ class JsonFile(object):
 
     def refresh(self):
         if self.path != None:
-            try:
-                with FileLock(self.path):
-                    fd = open(self.path, "r")
-                    self.data = json.load(fd, object_hook=deserialize_datetime)
-                    fd.close()
-            except IOError:
-                pass
-
+            with FileLock(self.path):
+                fd = open(self.path, "r")
+                self.data = json.load(fd, object_hook=deserialize_datetime)
+                fd.close()
+     
     def save(self, path=None):
         if path == None:
             path = self.path
index e5a733fb2b0fb1c4c7a6157efc07a6ee2e1c562a..8efe1712c31703f5bff39edda27f4fe08422ea6a 100755 (executable)
@@ -10,7 +10,12 @@ from maildir import *
 @route('/kite/<user>/mail')
 def index(user):
             # FIXME: input sanitization - check permissions for user
-            threads_index = JsonFile("/home/kite/Maildirs/%s/threads_index.json" % user)
+            try:
+                threads_index = JsonFile("/home/kite/Maildirs/%s/threads_index.json" % user)
+            except IOError:
+                response.status = 400
+                return
+
             ret_threads = []
             for thread in threads_index.data[-50:]:
                 ret_threads.append(thread)
index 5a039f750c8092dfeb2ab60f1af31879a120c79e..8821627c0ab2cb7a89816291b910b731cdd339e6 100644 (file)
@@ -10,9 +10,9 @@ angular.module('KiteMail.controllers', []).
             {"name": "Spam",  },];
             
 }).controller('MailsListController', ['$scope', 'Emails', function($scope, Emails) {
-        $scope.threads = Emails.threads({username: "kite"});
+        $scope.threads = Emails.threads({username: "testuser"});
 }]).controller('LoginController', function($scope) {
     
 }).controller('ThreadController', function($scope, $routeParams, Emails) {
-    $scope.thread = Emails.thread({username: "kite", "id": $routeParams.id});
+    $scope.thread = Emails.thread({username: "testuser", "id": $routeParams.id});
 });