Fix find_json_objects when there is a ...
Content-type: text/plain
Author: andar
Revision: 5620
Log:
Revert 5619
Fix find_json_objects when there is a newline at the end of the string
Add test for find_json_objects
Diff:
Modified: trunk/deluge/config.py
===================================================================
--- trunk/deluge/config.py 2009-08-03 19:49:47 UTC (rev 5619)
+++ trunk/deluge/config.py 2009-08-03 20:27:03 UTC (rev 5620)
@@ -72,7 +72,6 @@
import os
import deluge.common
-import deluge.configmanager
from deluge.log import LOG as log
json = deluge.common.json
@@ -115,9 +114,9 @@
opens += 1
elif c == "}":
opens -= 1
- if opens == 0:
- objects.append((start, index+offset+1))
- start = index + offset + 1
+ if opens == 0:
+ objects.append((start, index+offset+1))
+ start = index + offset + 1
return objects
@@ -153,7 +152,7 @@
if config_dir:
self.__config_file = os.path.join(config_dir, filename)
else:
- self.__config_file = deluge.configmanager.get_config_dir(filename)
+ self.__config_file = deluge.common.get_default_config_dir(filename)
self.load()
Modified: trunk/tests/test_config.py
===================================================================
--- trunk/tests/test_config.py 2009-08-03 19:49:47 UTC (rev 5619)
+++ trunk/tests/test_config.py 2009-08-03 20:27:03 UTC (rev 5620)
@@ -96,4 +96,19 @@
from twisted.internet import reactor
d = deferLater(reactor, 7, check_config, config)
return d
+
+ def test_find_json_objects(self):
+ s = """{
+ "file": 1,
+ "format": 1
+}{
+ "ssl": true,
+ "enabled": false,
+ "port": 8115
+}\n"""
+ from deluge.config import find_json_objects
+
+ objects = find_json_objects(s)
+ self.assertEquals(len(objects), 2)
+
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---