comparison makeitso/makeitso.py @ 31:17f46f0e0a4a

stub of using classes for this
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 22 Dec 2010 15:27:13 -0800
parents 1549be7f0fcb
children 9422d4ad6c2c
comparison
equal deleted inserted replaced
30:1549be7f0fcb 31:17f46f0e0a4a
80 f, headers = urllib.urlretrieve(uri) 80 f, headers = urllib.urlretrieve(uri)
81 return file(f).read() 81 return file(f).read()
82 82
83 ### things that deal with variables 83 ### things that deal with variables
84 84
85 # XXX duplicated in URITemplate namespace....don't need two
85 defaults = {'include': include} 86 defaults = {'include': include}
86 87
87 class MissingVariablesException(Exception): 88 class MissingVariablesException(Exception):
88 """exception for (non-interactive) missing variables""" 89 """exception for (non-interactive) missing variables"""
89 def __init__(self, message, missing): 90 def __init__(self, message, missing):
90 self.missing = missing 91 self.missing = missing
92
93 class ContentTemplate(tempita.Template):
94 """MakeItSo's extension of tempita's Template class"""
95 defaults = {'include': include}
96 def __init__(self):
97 raise NotImplementedError
98
99 class URITemplate(tempita.Template):
100
101 def __init__(self):
102 raise NotImplementedError
103
104 class DirectoryTemplate(tempita.Template):
105 def __init__(self):
106 raise NotImplementedError
91 107
92 def get_missing(name_error): 108 def get_missing(name_error):
93 """ 109 """
94 This is a horrible hack because python doesn't do the proper thing 110 This is a horrible hack because python doesn't do the proper thing
95 via eval and return the name of the variable; instead, it just gives 111 via eval and return the name of the variable; instead, it just gives