[tor-commits] [check/master] Some fixes for go1.0.x

arlo at torproject.org arlo at torproject.org
Fri Oct 25 23:33:22 UTC 2013


commit cbd6b1b15723b531876d0c7d7b4e239bc9685116
Author: Arlo Breault <arlolra at gmail.com>
Date:   Fri Oct 25 16:28:41 2013 -0700

    Some fixes for go1.0.x
---
 handlers.go        |    4 ++--
 public/index.html  |    4 ++--
 scripts/exitips.py |    8 +++++---
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/handlers.go b/handlers.go
index 57e82f8..f4a308f 100644
--- a/handlers.go
+++ b/handlers.go
@@ -18,7 +18,7 @@ var Locales = GetLocaleList()
 // page model
 type Page struct {
 	IsTor       bool
-	UpToDate    bool
+	NotUpToDate bool
 	Small       bool
 	Fingerprint string
 	OnOff       string
@@ -74,7 +74,7 @@ func RootHandler(Layout *template.Template, Exits *Exits, domain *gettext.Domain
 		// instance of your page model
 		p := Page{
 			isTor,
-			UpToDate(r),
+			!UpToDate(r),
 			Small(r),
 			fingerprint,
 			onOff,
diff --git a/public/index.html b/public/index.html
index 450c533..832ec99 100644
--- a/public/index.html
+++ b/public/index.html
@@ -4,7 +4,7 @@
 {{ define "head" }}
 <form action="/" method="get" id="lang">
   {{ if .Small }}<input type="hidden" name="small" value="1" />{{ end }}
-  {{ if And .IsTor (Not .UpToDate) }}<input type="hidden" name="uptodate" value="0" />{{ end }}
+  {{ if And .IsTor .NotUpToDate }}<input type="hidden" name="uptodate" value="0" />{{ end }}
   <label for="lang" class="small">{{ GetText .Lang "This page is also available in the following languages:" }}</label>
   <select id="cl" name="lang">
     {{ $out := . }}
@@ -28,7 +28,7 @@
     {{ end }}
   </h1>
   <p>{{ GetText .Lang "Your IP address appears to be: " }} <strong>{{ .IP }}</strong></p>
-  {{ if And .IsTor (Not .UpToDate) }}
+  {{ if And .IsTor .NotUpToDate }}
     <p class="security">
       {{ GetText .Lang "There is a security update available for the Tor Browser Bundle." }}<br />
       {{ GetText .Lang "<a href=\"https://www.torproject.org/download/download-easy.html\">Click here to go to the download page</a>" | UnEscaped }}
diff --git a/scripts/exitips.py b/scripts/exitips.py
index 49b7f03..7a27b5d 100755
--- a/scripts/exitips.py
+++ b/scripts/exitips.py
@@ -56,6 +56,8 @@ def main(consensuses, exit_lists):
                 for x in router.exit_policy._get_rules():
                     r.Rules.append({
                         "IsAddressWildcard": True,
+                        "Address": "",
+                        "Mask": "",
                         "IsAccept": x.is_accept,
                         "MinPort": x.min_port,
                         "MaxPort": x.max_port
@@ -83,7 +85,7 @@ def main(consensuses, exit_lists):
             rules = []
             for x in descriptor.exit_policy._get_rules():
                 is_address_wildcard = x.is_address_wildcard()
-                mask = None
+                mask = ""
                 if not is_address_wildcard:
                     address_type = x.get_address_type()
                     if (address_type == AddressType.IPv4 and
@@ -93,8 +95,8 @@ def main(consensuses, exit_lists):
                         mask = x.get_mask()
                 rules.append({
                     "IsAddressWildcard": is_address_wildcard,
-                    "Address": x.address,
-                    "Mask": mask,
+                    "Address": "" if x.address is None else x.address,
+                    "Mask": "" if mask is None else mask,
                     "IsAccept": x.is_accept,
                     "MinPort": x.min_port,
                     "MaxPort": x.max_port





More information about the tor-commits mailing list