3
0
Fork 0

Compare commits

..

2 commits

7 changed files with 26 additions and 10 deletions

View file

@ -5,6 +5,12 @@ All notable changes to wuttaweb will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## v0.16.1 (2024-12-08)
### Fix
- refactor to reflect usage of proper UUID values
## v0.16.0 (2024-12-05) ## v0.16.0 (2024-12-05)
### Feat ### Feat

View file

@ -6,7 +6,7 @@ build-backend = "hatchling.build"
[project] [project]
name = "WuttaWeb" name = "WuttaWeb"
version = "0.16.0" version = "0.16.1"
description = "Web App for Wutta Framework" description = "Web App for Wutta Framework"
readme = "README.md" readme = "README.md"
authors = [{name = "Lance Edgar", email = "lance@wuttaproject.org"}] authors = [{name = "Lance Edgar", email = "lance@wuttaproject.org"}]
@ -42,7 +42,7 @@ dependencies = [
"pyramid_tm", "pyramid_tm",
"waitress", "waitress",
"WebHelpers2", "WebHelpers2",
"WuttJamaican[db]>=0.16.1", "WuttJamaican[db]>=0.17.1",
"zope.sqlalchemy>=1.5", "zope.sqlalchemy>=1.5",
] ]

View file

@ -24,6 +24,8 @@
Form schema types Form schema types
""" """
import uuid as _uuid
import colander import colander
from wuttaweb.db import Session from wuttaweb.db import Session
@ -246,7 +248,14 @@ class ObjectRef(colander.SchemaType):
# fetch object from DB # fetch object from DB
model = self.app.model model = self.app.model
obj = self.session.get(self.model_class, value) obj = None
if isinstance(value, _uuid.UUID):
obj = self.session.get(self.model_class, value)
else:
try:
obj = self.session.get(self.model_class, _uuid.UUID(value))
except ValueError:
pass
# raise error if not found # raise error if not found
if not obj: if not obj:

View file

@ -563,7 +563,7 @@
const WuttaFeedbackFormData = { const WuttaFeedbackFormData = {
referrer: null, referrer: null,
userUUID: ${json.dumps(request.user.uuid if request.user else None)|n}, userUUID: ${json.dumps(request.user.uuid.hex if request.user else None)|n},
userName: ${json.dumps(str(request.user) if request.user else None)|n}, userName: ${json.dumps(str(request.user) if request.user else None)|n},
showDialog: false, showDialog: false,
sendingFeedback: false, sendingFeedback: false,

View file

@ -146,14 +146,14 @@ class TestRoleRefsWidget(WebTestCase):
# editable values list *excludes* admin (by default) # editable values list *excludes* admin (by default)
html = widget.serialize(field, {admin.uuid, blokes.uuid}) html = widget.serialize(field, {admin.uuid, blokes.uuid})
self.assertNotIn(admin.uuid, html) self.assertNotIn(str(admin.uuid), html)
self.assertIn(blokes.uuid, html) self.assertIn(str(blokes.uuid), html)
# but admin is included for root user # but admin is included for root user
self.request.is_root = True self.request.is_root = True
html = widget.serialize(field, {admin.uuid, blokes.uuid}) html = widget.serialize(field, {admin.uuid, blokes.uuid})
self.assertIn(admin.uuid, html) self.assertIn(str(admin.uuid), html)
self.assertIn(blokes.uuid, html) self.assertIn(str(blokes.uuid), html)
class TestUserRefsWidget(WebTestCase): class TestUserRefsWidget(WebTestCase):

View file

@ -1,5 +1,6 @@
# -*- coding: utf-8; -*- # -*- coding: utf-8; -*-
import uuid as _uuid
from unittest import TestCase from unittest import TestCase
from unittest.mock import MagicMock from unittest.mock import MagicMock
@ -90,7 +91,7 @@ class TestWuttaSecurityPolicy(TestCase):
# invalid identity yields no user # invalid identity yields no user
self.policy = self.make_policy() self.policy = self.make_policy()
self.policy.remember(self.request, 'bogus-user-uuid') self.policy.remember(self.request, _uuid.uuid4()) # random uuid
user = self.policy.identity(self.request) user = self.policy.identity(self.request)
self.assertIsNone(user) self.assertIsNone(user)

View file

@ -88,7 +88,7 @@ class TestCommonView(WebTestCase):
# basic send, with user # basic send, with user
self.request.user = user self.request.user = user
self.request.POST['user_uuid'] = user.uuid self.request.POST['user_uuid'] = str(user.uuid)
with patch.object(mod, 'Session', return_value=self.session): with patch.object(mod, 'Session', return_value=self.session):
context = view.feedback() context = view.feedback()
self.assertEqual(context, {'ok': True}) self.assertEqual(context, {'ok': True})