1.1 --- a/WebStack/Generic.py Thu Jan 29 23:42:47 2004 +0000
1.2 +++ b/WebStack/Generic.py Sun Feb 01 15:28:08 2004 +0000
1.3 @@ -19,7 +19,7 @@
1.4
1.5 "A container for content type information."
1.6
1.7 - def __init__(self, content_type, charset):
1.8 + def __init__(self, content_type, charset=None):
1.9 self.content_type = content_type
1.10 self.charset = charset
1.11
1.12 @@ -48,6 +48,22 @@
1.13 else:
1.14 return ContentType(t[0], t[1])
1.15
1.16 + def format_content_type(self, content_type):
1.17 +
1.18 + """
1.19 + Format the given 'content_type' object, producing a string suitable for
1.20 + the response header field.
1.21 + """
1.22 +
1.23 + if content_type.charset:
1.24 + field = "%s; charset=%s" % (content_type.content_type, content_type.charset)
1.25 + else:
1.26 + field = content_type.content_type
1.27 +
1.28 + # Make sure that only ASCII is used in the header.
1.29 +
1.30 + return field.encode("US-ASCII")
1.31 +
1.32 def parse_content_preferences(self, accept_preference):
1.33
1.34 """
1.35 @@ -122,6 +138,14 @@
1.36
1.37 raise NotImplementedError, "get_content_languages"
1.38
1.39 + def get_path(self):
1.40 +
1.41 + """
1.42 + A framework-specific method which gets the entire path from the request.
1.43 + """
1.44 +
1.45 + raise NotImplementedError, "get_path"
1.46 +
1.47 def get_path_info(self):
1.48
1.49 """