Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VTODO int cannot be int #178

Open
tieugene opened this issue Dec 7, 2021 · 2 comments
Open

VTODO int cannot be int #178

tieugene opened this issue Dec 7, 2021 · 2 comments

Comments

@tieugene
Copy link

tieugene commented Dec 7, 2021

Code:

import vobject
v = vobject.iCalendar()
v.add('vtodo')
v.vtodo.add('sequence').value = 1
v.serialize()

Result:

...
  File "/usr/local/lib/python3.9/site-packages/vobject/base.py", line 1219, in backslashEscape
    s = s.replace("\\", "\\\\").replace(";", "\;").replace(",", "\,")
AttributeError: 'int' object has no attribute 'replace'
@tieugene tieugene changed the title VTODO Sequence cannot be int VTODO int cannot be int Dec 20, 2021
@tieugene
Copy link
Author

tieugene commented Dec 20, 2021

The same with priority and percent-complete

@da4089
Copy link
Collaborator

da4089 commented Feb 24, 2024

The code is expecting a string value.

It seems like it'd be better to accept native integer types for integer values (and floats for floats, etc). I need to look at this a bit more, but superficially, it seems like native type values should be converted to strings, and only native string values should need backslash quoting.

The root of this seems to be that the line (a ContentLine instance) has its behavior set to TextBehavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants