Re: [dev] RFC: Transaction meta data
"David Glick (Glick Software)" <[email protected]>
| Newsgroups | gmane.comp.web.zope.zodb |
|---|---|
| Message-ID | <[email protected]> |
On 3/16/17 3:19 PM, Jim Fulton wrote: > > > On Thu, Mar 9, 2017 at 1:38 PM, Jim Fulton <[email protected] > <mailto:[email protected]>> wrote: > > > > On Thu, Mar 9, 2017 at 1:02 PM, Hanno Schlichting > <[email protected] <mailto:[email protected]>> wrote: > > On Thu, Mar 9, 2017, at 18:58, Jim Fulton wrote: > > ... > > At least in older Zope 2 releases, both None and integers are > used in meta data as well. > > > whimper. Well, None I'd be inclined to treat at a noop. > > > There didn't seem to be any objections to treating None as a noop. I > suggested that because I assumed that None was being passed because it > was some default somewhere. > > ... > > I was being lazy. I just looked at the ZODB 4 and transaction 1 code: > > - Passing None or an int to note() would have error-ed, because note() > strips it's argument. > > - Setting description or user to None would have caused FileStorage to > error, because it gets their lengths. There was no code that I could > see that stringifies these either, so I don't think anything was > assigning them directly. > > I'm guessing that None can be passed as the user to setUser, which > makes perfect sense, for unauthenticated requests. > > Oh, and I bet integers principal ids are passed to getUser as well. > > How'm I doing? > > If my analysis is correct, assigning directly to user or description > with anything other than text or bytes should error, as it did before. > Ditto for passing anything but text or bytes to note(). setUser can > continue to stringify with a warning. > > What do you think? > > Help me out here folks. :) I can confirm that's what I'm seeing for note() in existing releases of Plone (transaction 1.1.1 and ZODB 3.10.5 -- yeah, I know, sorry): >>> transaction.get().note(None) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/davisagli/.buildout/eggs/transaction-1.1.1-py2.7.egg/transaction/_transaction.py", line 523, in note text = text.strip() AttributeError: 'NoneType' object has no attribute 'strip' >>> transaction.get().note(1) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/davisagli/.buildout/eggs/transaction-1.1.1-py2.7.egg/transaction/_transaction.py", line 523, in note text = text.strip() AttributeError: 'int' object has no attribute 'strip' -- You received this message because you are subscribed to the Google Groups "zodb" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.