~james-chin/sahana-eden/test

« back to all changes in this revision

Viewing changes to modules/s3/s3codecs.py

  • Committer: Fran Boon
  • Date: 2011-08-20 12:52:34 UTC
  • mfrom: (2398.3.157 eden)
  • Revision ID: fran@aidiq.com-20110820125234-co3wjmsqgyq75exr
Merge Trunk: S3Method._permitted(), OCR fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
102
102
            s = escape(s, {"'": "'", '"': """})
103
103
        return s
104
104
 
 
105
    #--------------------------------------------------------------------------
105
106
    @staticmethod
106
107
    def xml_decode(s):
107
108
        """
114
115
            s = unescape(s, {"'": "'", """: '"'})
115
116
        return s
116
117
 
 
118
    #--------------------------------------------------------------------------
117
119
    def decode_iso_datetime(self, dtstr):
118
120
        """
119
121
            Convert date/time string in ISO-8601 format into a
131
133
            dt = dateutil.parser.parse(dtstr + "+0000", default=DEFAULT)
132
134
        return dt
133
135
 
 
136
    #--------------------------------------------------------------------------
134
137
    def as_utc(self, dt):
135
138
        """
136
139
            Get a datetime object for the same date/time as the
142
145
            return dt
143
146
        return dt.astimezone(dateutil.tz.tzutc())
144
147
 
 
148
    #--------------------------------------------------------------------------
145
149
    def encode_iso_datetime(self, dt):
146
150
        """
147
151
            Convert a datetime object into a ISO-8601 formatted
152
156
        dx = dt - datetime.timedelta(microseconds=dt.microsecond)
153
157
        return dx.isoformat()
154
158
 
 
159
    #--------------------------------------------------------------------------
155
160
    def encode_local_datetime(self, dt):
156
161
        """
157
162
            Convert a datetime object into a local date/time formatted