Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@sugarlabs.org>2013-09-01 16:43:25 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2013-09-01 17:28:13 (GMT)
commit9698872e43189398db63543fb82d4ab9ff0c93d0 (patch)
tree1ed8484448472e2082124faff85429b0a12bdf94
parentb5e5e75337b415218496552834b66f5953d7b3d6 (diff)
Ignore mtime float part while selecting files using IF_MODIFIED_SINCE value
-rw-r--r--TODO4
-rw-r--r--sugar_network/client/cache.py3
-rw-r--r--sugar_network/client/routes.py2
-rw-r--r--sugar_network/node/routes.py2
-rw-r--r--sugar_network/toolkit/router.py2
-rw-r--r--tests/__init__.py1
-rwxr-xr-xtests/units/client/cache.py3
7 files changed, 7 insertions, 10 deletions
diff --git a/TODO b/TODO
index d4a542c..613bd9e 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,3 @@
-- on launch failures, upload system logs
-- do failure upload in background
- show only packages in /packages API call
- (!) Editors' workflows:
@@ -8,10 +6,8 @@
- Remove temporal security hole with speciying guid in POST,
it was added as a fast hack to support offline creation (with later pushing to a node)
-- activities migth need MIME registering while checking-in
- changed pulls should take into account accept_length
- handle DELETE while calculating per-object node stats
-- unstall activities on checking out and on initial syncing
- increase granularity for sync.chunked_encode()
- slave._Pooler might leak events if pullers are not in time to call wait()
- revert per-document "downloads" property as "launches", a part of unpersonizalied user_stats
diff --git a/sugar_network/client/cache.py b/sugar_network/client/cache.py
index 685bdf4..0858969 100644
--- a/sugar_network/client/cache.py
+++ b/sugar_network/client/cache.py
@@ -14,6 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
+import sys
import json
import time
import logging
@@ -125,7 +126,7 @@ class Cache(object):
# TODO Sonds like a tmpfs or so
return 0
- limit = 0
+ limit = sys.maxint
free = stat.f_bfree * stat.f_frsize
if client.cache_limit_percent.value:
total = stat.f_blocks * stat.f_frsize
diff --git a/sugar_network/client/routes.py b/sugar_network/client/routes.py
index 268ef38..10d82af 100644
--- a/sugar_network/client/routes.py
+++ b/sugar_network/client/routes.py
@@ -88,7 +88,7 @@ class ClientRoutes(model.FrontRoutes, implementations.Routes, journal.Routes):
path = ['index.html']
path = join(client.hub_root.value, *path)
- mtime = os.stat(path).st_mtime
+ mtime = int(os.stat(path).st_mtime)
if request.if_modified_since >= mtime:
raise http.NotModified()
diff --git a/sugar_network/node/routes.py b/sugar_network/node/routes.py
index 705d7c2..680c934 100644
--- a/sugar_network/node/routes.py
+++ b/sugar_network/node/routes.py
@@ -121,7 +121,7 @@ class NodeRoutes(model.VolumeRoutes, model.FrontRoutes):
if '.' in filename:
continue
path = join(root, filename)
- mtime = os.stat(path).st_mtime
+ mtime = int(os.stat(path).st_mtime)
if mtime > request.if_modified_since:
result.append(filename)
last_modified = max(last_modified, mtime)
diff --git a/sugar_network/toolkit/router.py b/sugar_network/toolkit/router.py
index 117d8cc..574b1ef 100644
--- a/sugar_network/toolkit/router.py
+++ b/sugar_network/toolkit/router.py
@@ -443,7 +443,7 @@ class Router(object):
path = result['blob']
enforce(isfile(path), 'No such file')
- mtime = result.get('mtime') or os.stat(path).st_mtime
+ mtime = result.get('mtime') or int(os.stat(path).st_mtime)
if request.if_modified_since and mtime and \
mtime <= request.if_modified_since:
raise http.NotModified()
diff --git a/tests/__init__.py b/tests/__init__.py
index da59a40..adbd83f 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -92,6 +92,7 @@ class Test(unittest.TestCase):
client.ipc_port.value = 5555
client.layers.value = None
client.cache_limit.value = 0
+ client.cache_limit_percent.value = 0
client.cache_lifetime.value = 0
client_routes._RECONNECT_TIMEOUT = 0
mountpoints._connects.clear()
diff --git a/tests/units/client/cache.py b/tests/units/client/cache.py
index af05f43..31dc78c 100755
--- a/tests/units/client/cache.py
+++ b/tests/units/client/cache.py
@@ -30,8 +30,6 @@ class CacheTest(tests.Test):
self.statvfs = statvfs
self.override(os, 'statvfs', lambda *args: statvfs())
- cache_limit.value = 0
- cache_limit_percent.value = 0
def test_open(self):
volume = db.Volume('db', [Context, Implementation])
@@ -134,6 +132,7 @@ class CacheTest(tests.Test):
assert volume['implementation'].exists('2')
assert volume['implementation'].exists('3')
+ print '----------'
cache.ensure(2, 0)
assert not volume['implementation'].exists('1')
assert volume['implementation'].exists('2')