|
29 | 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | 30 | """ |
31 | 31 |
|
32 | | -from __future__ import annotations # Requried for 3.7 |
| 32 | +from __future__ import annotations # Required for compatibility with Python 3.7 |
33 | 33 |
|
34 | 34 | import base64 |
35 | 35 | import copy |
@@ -3162,29 +3162,17 @@ def authenticate_human_user( |
3162 | 3162 | self.config.auth_token = auth_token |
3163 | 3163 |
|
3164 | 3164 | try: |
3165 | | - data = self.find_one( |
| 3165 | + return self.find_one( |
3166 | 3166 | "HumanUser", |
3167 | 3167 | [["sg_status_list", "is", "act"], ["login", "is", user_login]], |
3168 | 3168 | ["id", "login"], |
3169 | 3169 | "", |
3170 | 3170 | "all", |
3171 | 3171 | ) |
3172 | | - # Set back to default - There finally and except cannot be used together in python2.4 |
3173 | | - self.config.user_login = original_login |
3174 | | - self.config.user_password = original_password |
3175 | | - self.config.auth_token = original_auth_token |
3176 | | - return data |
3177 | | - except Fault: |
3178 | | - # Set back to default - There finally and except cannot be used together in python2.4 |
3179 | | - self.config.user_login = original_login |
3180 | | - self.config.user_password = original_password |
3181 | | - self.config.auth_token = original_auth_token |
3182 | | - except Exception: |
3183 | | - # Set back to default - There finally and except cannot be used together in python2.4 |
| 3172 | + finally: |
3184 | 3173 | self.config.user_login = original_login |
3185 | 3174 | self.config.user_password = original_password |
3186 | 3175 | self.config.auth_token = original_auth_token |
3187 | | - raise |
3188 | 3176 |
|
3189 | 3177 | def update_project_last_accessed( |
3190 | 3178 | self, project: Dict[str, Any], user: Optional[Dict[str, Any]] = None |
@@ -4191,10 +4179,7 @@ def _inbound_visitor(value): |
4191 | 4179 | if isinstance(value, str): |
4192 | 4180 | if len(value) == 20 and self._DATE_TIME_PATTERN.match(value): |
4193 | 4181 | try: |
4194 | | - # strptime was not on datetime in python2.4 |
4195 | | - value = datetime.datetime( |
4196 | | - *time.strptime(value, "%Y-%m-%dT%H:%M:%SZ")[:6] |
4197 | | - ) |
| 4182 | + value = datetime.datetime.strptime(value, "%Y-%m-%dT%H:%M:%SZ") |
4198 | 4183 | except ValueError: |
4199 | 4184 | return value |
4200 | 4185 | if _change_tz: |
|
0 commit comments