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.
Files changed (31) hide show
  1. {horsemeat-2.22.11 → horsemeat-2.22.13}/PKG-INFO +1 -1
  2. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/configwrapper.py +3 -2
  3. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/model/session.py +45 -1
  4. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/pg.py +1 -0
  5. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/version.py +1 -1
  6. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat.egg-info/PKG-INFO +1 -1
  7. {horsemeat-2.22.11 → horsemeat-2.22.13}/MANIFEST.in +0 -0
  8. {horsemeat-2.22.11 → horsemeat-2.22.13}/README +0 -0
  9. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/__init__.py +0 -0
  10. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/model/__init__.py +0 -0
  11. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/model/newsmessage.py +0 -0
  12. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/model/user.py +0 -0
  13. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/scripts/make-frippery-project +0 -0
  14. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/tests/__init__.py +0 -0
  15. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/tests/test_configwrapper.py +0 -0
  16. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/webapp/__init__.py +0 -0
  17. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/webapp/bogusrequest.py +0 -0
  18. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/webapp/dispatcher.py +0 -0
  19. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/webapp/framework_templates/__init__.py +0 -0
  20. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/webapp/frameworkhandlers.py +0 -0
  21. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/webapp/handler.py +0 -0
  22. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/webapp/request.py +0 -0
  23. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/webapp/response.py +0 -0
  24. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat/webapp/scrubber.py +0 -0
  25. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat.egg-info/SOURCES.txt +0 -0
  26. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat.egg-info/dependency_links.txt +0 -0
  27. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat.egg-info/requires.txt +0 -0
  28. {horsemeat-2.22.11 → horsemeat-2.22.13}/horsemeat.egg-info/top_level.txt +0 -0
  29. {horsemeat-2.22.11 → horsemeat-2.22.13}/requirements.txt +0 -0
  30. {horsemeat-2.22.11 → horsemeat-2.22.13}/setup.cfg +0 -0
  31. {horsemeat-2.22.11 → horsemeat-2.22.13}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: horsemeat
3
- Version: 2.22.11
3
+ Version: 2.22.13
4
4
  Summary: Web framework for the damned. The mad.
5
5
  Home-page: https://github.com/216software/horsemeat
6
6
  Author: 216 Software, LLC
@@ -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 {0}.".format(
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
- """), {'session_uuid': self.session_uuid})
234
+ """), {'session_uuid': self.session_uuid})
191
235
 
192
236
  if cursor.rowcount:
193
237
  return cursor.fetchone().expires
@@ -1,6 +1,7 @@
1
1
  # vim: set expandtab ts=4 sw=4 filetype=python fileencoding=utf8:
2
2
 
3
3
  import logging
4
+ import textwrap
4
5
 
5
6
  log = logging.getLogger(__name__)
6
7
 
@@ -22,4 +22,4 @@ hasn't been installed yet.
22
22
 
23
23
  """
24
24
 
25
- __version__ = '2.22.11'
25
+ __version__ = '2.22.13'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: horsemeat
3
- Version: 2.22.11
3
+ Version: 2.22.13
4
4
  Summary: Web framework for the damned. The mad.
5
5
  Home-page: https://github.com/216software/horsemeat
6
6
  Author: 216 Software, LLC
File without changes
File without changes
File without changes
File without changes