changeset 26:0faf3e7b593a

more stubbing
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 25 Nov 2011 00:08:34 -0800
parents 8729685a2cf6
children 7e0c931a201d
files licenser/licenses.py licenser/web.py
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/licenser/licenses.py	Fri Nov 25 00:01:15 2011 -0800
+++ b/licenser/licenses.py	Fri Nov 25 00:08:34 2011 -0800
@@ -240,7 +240,7 @@
         if hasattr(self, '_license'):
             # return the cached copy
             return self._license
-        
+
         # get the raw license
         raw = urllib2.urlopen(self.url).read()
 
--- a/licenser/web.py	Fri Nov 25 00:01:15 2011 -0800
+++ b/licenser/web.py	Fri Nov 25 00:08:34 2011 -0800
@@ -5,6 +5,7 @@
 """
 
 import licenses
+import tempfile
 from webob import Request, Response, exc
 
 class Handler(object):
@@ -59,6 +60,15 @@
     def POST(self, request):
         pass
 
+    def interpolate(self, filename, body, name, email):
+        fd, tf = tempfile.mkstemp()
+        try:
+            os.write(fd, body)
+            os.close(fd)
+        finally:
+            os.remove(tf)
+
+
 if __name__ == '__main__':
     from wsgiref import simple_server
     app = Handler()