infocalypse
 
(Steve Dougherty)
2013-07-02: Merge arnebab bugs and typo fixes.

Merge arnebab bugs and typo fixes.

diff --git a/.bugs/bugs b/.bugs/bugs
--- a/.bugs/bugs
+++ b/.bugs/bugs
@@ -1,3 +1,5 @@
+minimize dependencies                                        | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:0fc25f7b84f3e1fb89e9134a28eeabbe76bf054f, time:1372231529.45
 pull fails, because config.get_wot_identity requests self.defaults['DEFAULT_TRUSTER'] which is not in defaults. | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:31beb672d404944a4655a546b21c95c7baa91002, time:1371735138.39
 set the timezone to UTC on cloning a freenet repo to avoid timezone-based attacks. | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:4dfc4cc28a7fa69f040776a7138da78ee89ec819, time:1355764180.36
 mime-type problems                                           | owner:Arne Babenhauserheide <bab@draketo.de>, open:False, id:5916e6e8328e20d8b0276b76b7116dd432730778, time:1353463866.97
+simpler-wot-uris: name/repo                                  | owner:Arne Babenhauserheide <bab@draketo.de>, open:True, id:d4f2df3ca2c441e4be389be846634f5a4a08906e, time:1372232568.9
diff --git a/.bugs/details/0fc25f7b84f3e1fb89e9134a28eeabbe76bf054f.txt b/.bugs/details/0fc25f7b84f3e1fb89e9134a28eeabbe76bf054f.txt
new file mode 100644
--- /dev/null
+++ b/.bugs/details/0fc25f7b84f3e1fb89e9134a28eeabbe76bf054f.txt
@@ -0,0 +1,28 @@
+# Lines starting with '#' and sections without content
+# are not displayed by a call to 'details'
+#
+[paths]
+# Paths related to this bug.
+# suggested format: REPO_PATH:LINENUMBERS
+
+
+[details]
+# Additional details
+- Use plain stdlib where possible
+- Maybe merge the repo with pyFreenet, if we actually need it.
+- replace defusedxml?
+
+[expected]
+# The expected result
+
+
+[actual]
+# What happened instead
+
+
+[reproduce]
+# Reproduction steps
+
+
+[comments]
+# Comments and updates - leave your name
diff --git a/.bugs/details/4dfc4cc28a7fa69f040776a7138da78ee89ec819.txt b/.bugs/details/4dfc4cc28a7fa69f040776a7138da78ee89ec819.txt
--- a/.bugs/details/4dfc4cc28a7fa69f040776a7138da78ee89ec819.txt
+++ b/.bugs/details/4dfc4cc28a7fa69f040776a7138da78ee89ec819.txt
@@ -8,11 +8,12 @@
 
 [details]
 # Additional details
-
+Only file USKs are allowed.
+Make sure the URI ends with '/<number>' with no trailing '/'
 
 [expected]
 # The expected result
-
+Without number it could just assume /0
 
 [actual]
 # What happened instead
diff --git a/infocalypse/commands.py b/infocalypse/commands.py
--- a/infocalypse/commands.py
+++ b/infocalypse/commands.py
@@ -108,7 +108,8 @@ def infocalypse_create(ui_, repo, **opts
     inserted_to = execute_create(ui_, repo, params, stored_cfg)
 
     if inserted_to and opts['wot']:
-        # TODO: Imports don't go out of scope, right?
+        # TODO: Imports don't go out of scope, right? The variables
+        # from the import are only visible in the function, so yes.
         import wot
         wot.update_repo_listing(ui_, attributes['Identity'])
 
diff --git a/infocalypse/config.py b/infocalypse/config.py
--- a/infocalypse/config.py
+++ b/infocalypse/config.py
@@ -136,7 +136,13 @@ class Config:
         self.file_name = None
 
         # Use a dict instead of members to avoid pylint R0902.
-        # REDFLAG: Why is this called defaults? BAD NAME. Perhaps 'values'?
+
+        # REDFLAG: Why is this called defaults? BAD NAME. Perhaps 'values'? 
+        # That would conflict with the .values() method of
+        # dictionaries. config.config sounds OK, I think (though it is
+        # a bit awkward to have the same name twice. But that is also
+        # done at other places, IIRC, so it should not be too
+        # surprising).
         self.defaults = {}
         self.defaults['HOST'] = '127.0.0.1'
         self.defaults['PORT'] = 9481
diff --git a/infocalypse/wot.py b/infocalypse/wot.py
--- a/infocalypse/wot.py
+++ b/infocalypse/wot.py
@@ -34,7 +34,12 @@ def send_pull_request(ui, repo, from_ide
 
     repo_context = repo['tip']
     # TODO: Will there always be a request URI set in the config? What about
-    # a path?
+    # a path? The repo could be missing a request URI, if that URI is
+    # set manually. We could check whether the default path is a
+    # freenet path. We cannot be sure whether the request uri will
+    # always be the uri we want to send the pull-request to, though:
+    # It might be an URI we used to get some changes which we now want
+    # to send back to the maintainer of the canonical repo.
     from_uri = cfg.get_request_uri(repo.root)
     from_branch = repo_context.branch()
 
@@ -66,7 +71,7 @@ HG: or putting things below it has the p
     # TODO: Save message and load later in case sending fails.
 
     # TODO: What if the editor uses different line endings? How to slice
-    # by-line?
+    # by-line? Just use .splitlines()
     source_lines = source_text.split('\n')
 
     # Body is third line and after.
@@ -84,8 +89,13 @@ HG: or putting things below it has the p
 def receive_pull_requests(ui):
     # TODO: Terminology - send/receive different from resolve/read elsewhere.
     # TODO: How to find YAML? Look from end backwards for "---\n" then forward
-    # from there for "...\n"?
+    # from there for "...\n"? Yepp, that should be the simplest way. If the 
+    # end is ... (without linebreak) that could be a user-error which we might 
+    # accept: It is valid: http://www.yaml.org/spec/1.2/spec.html#id2760395
     # TODO: How to match local repo with the "target" URI? Based on repo list.
+    # all keys which have an insert key for this path would be pull-targets
+    # to check. Maybe retrieve the insert keys and invert them to get the 
+    # request keys (or can we just use the insert keys to query Freemail?).
 
     cfg = Config.from_ui(ui)
     imap = imaplib.IMAP4(cfg.defaults['HOST'], FREEMAIL_IMAP_PORT)