forked from gergely/calendar-social
		
	[Refactor] Refactor Event.__as_tz() so it accepts a timezone
Until now it could only convert to the event’s timezone
This commit is contained in:
		@@ -110,10 +110,12 @@ class Event(db.Model):
 | 
			
		||||
    #: The description of the event
 | 
			
		||||
    description = db.Column(db.UnicodeText())
 | 
			
		||||
 | 
			
		||||
    def __as_tz(self, timestamp):
 | 
			
		||||
        from pytz import timezone, utc
 | 
			
		||||
    def __as_tz(self, timestamp, as_timezone=None):
 | 
			
		||||
        from pytz import timezone, UTC
 | 
			
		||||
 | 
			
		||||
        return utc.localize(timestamp).astimezone(timezone(self.time_zone))
 | 
			
		||||
        utc_timestamp = UTC.localize(timestamp)
 | 
			
		||||
 | 
			
		||||
        return utc_timestamp.astimezone(as_timezone or timezone(self.time_zone))
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def start_time_tz(self):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user