horsemeat 2.22.11__tar.gz → 2.22.13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {horsemeat-2.22.11 → horsemeat-2.22.13}/PKG-INFO +1 -1
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/configwrapper.py +3 -2
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/model/session.py +45 -1
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/pg.py +1 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/version.py +1 -1
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat.egg-info/PKG-INFO +1 -1
- {horsemeat-2.22.11 → horsemeat-2.22.13}/MANIFEST.in +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/README +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/__init__.py +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/model/__init__.py +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/model/newsmessage.py +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/model/user.py +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/scripts/make-frippery-project +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/tests/__init__.py +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/tests/test_configwrapper.py +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/webapp/__init__.py +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/webapp/bogusrequest.py +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/webapp/dispatcher.py +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/webapp/framework_templates/__init__.py +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/webapp/frameworkhandlers.py +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/webapp/handler.py +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/webapp/request.py +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/webapp/response.py +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/webapp/scrubber.py +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat.egg-info/SOURCES.txt +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat.egg-info/dependency_links.txt +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat.egg-info/requires.txt +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat.egg-info/top_level.txt +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/requirements.txt +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/setup.cfg +0 -0
- {horsemeat-2.22.11 → horsemeat-2.22.13}/setup.py +0 -0
@@ -85,6 +85,8 @@ class ConfigWrapper(object):
|
|
85
85
|
yaml.safe_load(stream),
|
86
86
|
yaml_file_name=filename)
|
87
87
|
|
88
|
+
stream.close()
|
89
|
+
|
88
90
|
return self
|
89
91
|
|
90
92
|
@classmethod
|
@@ -193,8 +195,7 @@ class ConfigWrapper(object):
|
|
193
195
|
user=self.database_user,
|
194
196
|
password=self.database_password)
|
195
197
|
|
196
|
-
log.info("Just made postgresql connection {
|
197
|
-
pgconn))
|
198
|
+
log.info(f"Just made postgresql connection {pgconn} (composite types registered: {register_composite_types}.")
|
198
199
|
|
199
200
|
psycopg2.extras.register_uuid()
|
200
201
|
psycopg2.extras.register_hstore(pgconn, globally=True)
|
@@ -177,8 +177,52 @@ class Session(object):
|
|
177
177
|
self.inserted = inserted
|
178
178
|
self.updated = updated
|
179
179
|
|
180
|
+
def expire(self, pgconn):
|
181
|
+
|
182
|
+
"""
|
183
|
+
This sets the expires field to right now, which means they are
|
184
|
+
now logged out of this session.
|
185
|
+
"""
|
186
|
+
|
187
|
+
cursor = pgconn.cursor()
|
188
|
+
|
189
|
+
cursor.execute(textwrap.dedent("""
|
190
|
+
update webapp_sessions
|
191
|
+
set expires = current_timestamp
|
192
|
+
where session_uuid = (%(session_uuid)s)
|
193
|
+
and expires > current_timestamp
|
194
|
+
returning expires
|
195
|
+
"""), {'session_uuid': self.session_uuid})
|
196
|
+
|
197
|
+
if cursor.rowcount:
|
198
|
+
return cursor.fetchone().expires
|
199
|
+
|
200
|
+
@classmethod
|
201
|
+
def expire_all_sessions_for_user(cls, pgconn, person_uuid):
|
202
|
+
|
203
|
+
cursor = pgconn.cursor()
|
204
|
+
|
205
|
+
cursor.execute(textwrap.dedent("""
|
206
|
+
update webapp_sessions
|
207
|
+
set expires = current_timestamp
|
208
|
+
where person_uuid = (%(person_uuid)s)
|
209
|
+
and expires > current_timestamp
|
210
|
+
returning (webapp_sessions.*)::webapp_sessions as expired_session
|
211
|
+
"""), {'person_uuid': self.person_uuid})
|
212
|
+
|
213
|
+
if cursor.rowcount:
|
214
|
+
return cursor
|
215
|
+
|
216
|
+
|
180
217
|
def maybe_update_session_expires_time(self, pgconn):
|
181
218
|
|
219
|
+
"""
|
220
|
+
This resets the expires field to the default, which is now() +
|
221
|
+
interval '1 hour'.
|
222
|
+
|
223
|
+
Use this to keep somebody logged in for another hour.
|
224
|
+
"""
|
225
|
+
|
182
226
|
cursor = pgconn.cursor()
|
183
227
|
|
184
228
|
cursor.execute(textwrap.dedent("""
|
@@ -187,7 +231,7 @@ class Session(object):
|
|
187
231
|
where session_uuid = (%(session_uuid)s)
|
188
232
|
and expires > current_timestamp
|
189
233
|
returning expires
|
190
|
-
|
234
|
+
"""), {'session_uuid': self.session_uuid})
|
191
235
|
|
192
236
|
if cursor.rowcount:
|
193
237
|
return cursor.fetchone().expires
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|