Revision 08494423 snf-astakos-app/astakos/im/models.py

b/snf-astakos-app/astakos/im/models.py
111 111
    auth_token_expires = models.DateTimeField(
112 112
        _('Token expiration date'), null=True)
113 113

  
114
    def renew_token(self):
114
    def renew_token(self, expiration_date=None):
115 115
        md5 = hashlib.md5()
116 116
        md5.update(self.name.encode('ascii', 'ignore'))
117 117
        md5.update(self.url.encode('ascii', 'ignore'))
......
119 119

  
120 120
        self.auth_token = b64encode(md5.digest())
121 121
        self.auth_token_created = datetime.now()
122
        self.auth_token_expires = self.auth_token_created + \
123
            timedelta(hours=AUTH_TOKEN_DURATION)
122
        if expiration_date:
123
            self.auth_token_expires = expiration_date
124
        else:
125
            self.auth_token_expires = None
124 126

  
125 127
    def __str__(self):
126 128
        return self.name

Also available in: Unified diff