Events inserted with Python 2 contain unicode `u''` literals
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 30
- Forks
- 13
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 8
Description
recurrence column of event stores either a Python serialized string or a list because it uses repr to serialize it and also ast.literal_eval to deserialize it.
SELECT e.recurrence FROM recurringevent r JOIN event e ON e.id = r.id WHERE e.recurrence LIKE BINARY '%u\'%' LIMIT 20;
| recurrence |
|---|
| [u'RRULE:FREQ=WEEKLY;UNTIL=20160801T165959Z;BYDAY=TU'] |
| [u'RRULE:FREQ=WEEKLY;UNTIL=20161025T150000Z;BYDAY=TU'] |
| [u'RRULE:FREQ=WEEKLY;UNTIL=20161130T075959Z;BYDAY=MO,WE,FR'] |
| [u'RRULE:FREQ=WEEKLY;UNTIL=20161202T075959Z;BYDAY=MO,WE,FR'] |
| [u'RRULE:FREQ=WEEKLY;UNTIL=20160912T065959Z;BYDAY=MO'] |
| [u'RRULE:FREQ=WEEKLY;UNTIL=20160919T035959Z;BYDAY=MO'] |
| [u'RRULE:FREQ=WEEKLY;UNTIL=20161031T162959Z;BYDAY=MO'] |
| [u'RRULE:FREQ=WEEKLY;UNTIL=20161212T045959Z;BYDAY=MO'] |
| [u'RRULE:FREQ=WEEKLY;UNTIL=20170118T045959Z;INTERVAL=2;BYDAY=WE'] |
| [u'RRULE:FREQ=WEEKLY;UNTIL=20170427T170000Z;BYDAY=MO,TH'] |
| [u'RRULE:FREQ=WEEKLY;UNTIL=20170414T204500Z;BYDAY=MO,WE,FR'] |
| [u'RRULE:FREQ=WEEKLY;UNTIL=20170405T223000Z;BYDAY=WE'] |
| [u'RRULE:FREQ=WEEKLY;UNTIL=20170419T201500Z;INTERVAL=2;BYDAY=WE'] |
| [u'RRULE:FREQ=WEEKLY;UNTIL=20170424T203000Z;BYDAY=MO'] |
| [u'EXDATE;TZID=America/Los_Angeles:20161226T130000', u'RRULE:FREQ=WEEKLY;UNTIL=20170508T200000Z;BYDAY=MO'] |
| [u'RRULE:FREQ=DAILY;UNTIL=20170629T130000Z'] |
| [u'EXDATE;TZID=America/Los_Angeles:20161221T160000,20170104T160000', u'RRULE:FREQ=WEEKLY;UNTIL=20170206T075959Z;BYDAY=MO,WE'] |
| [u'RRULE:FREQ=WEEKLY;UNTIL=20170510T065959Z;BYDAY=MO,WE'] |
| [u'RRULE:FREQ=WEEKLY;UNTIL=20170821T065959Z;BYDAY=MO,WE'] |
| [u'RRULE:FREQ=WEEKLY;UNTIL=20170911T065959Z;BYDAY=MO,WE'] |
At present with Python 3 the parser still accepts u'' literals:
>>> ast.literal_eval("[u'RRULE:FREQ=WEEKLY;UNTIL=20170118T045959Z;INTERVAL=2;BYDAY=WE']")
['RRULE:FREQ=WEEKLY;UNTIL=20170118T045959Z;INTERVAL=2;BYDAY=WE']
but it can change in the future, which would break sync engine.
- Remove u prefixes from data saved in the db
- Consider switching this field to JSON for better future compatibility
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the recurrence serialization and deserialization references in inbox/models/event.py at lines 464 and 331, then inspect the stored rows using the SQL query in the issue. Determine how existing database values should be handled and whether the field should remain repr-based or move to JSON; done means Python 2 data no longer depends on u'' literals and recurrence values remain readable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, sql
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100