You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanna put a reply keyboard object into the redis storage, but it's impossible. I saw to_python() method of the ReplyKeyboardMarkup object and decided that I'll use that method to serialize the object in the redis storage and I'll use to_object(data) method to get the keyboard from the redis storage and back it to object.
Current Behavior
If I use the KeyboardButton object for ReplyKeyboarkMarkup.add() method, it'll return an error when I do to_object()
If I don't use that and just put a string into ReplyKeyboarkMarkup.add() method, it'll works fine without any error.
Failure Information (for bugs)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.8/site-packages/aiogram/types/base.py", line 145, in to_object
return cls(**data)
File "/usr/lib/python3.8/site-packages/aiogram/types/reply_keyboard.py", line 35, in __init__
super(ReplyKeyboardMarkup, self).__init__(keyboard=keyboard, resize_keyboard=resize_keyboard,
File "/usr/lib/python3.8/site-packages/aiogram/types/base.py", line 91, in __init__
self.props[key].set_value(self, value, parent=self)
File "/usr/lib/python3.8/site-packages/aiogram/types/fields.py", line 56, in set_value
value = self.deserialize(value, parent)
File "/usr/lib/python3.8/site-packages/aiogram/types/fields.py", line 161, in deserialize
row_result.append(deserialize(item, parent=parent))
File "/usr/lib/python3.8/site-packages/aiogram/types/fields.py", line 112, in deserialize
return self.base_object(conf={'parent': parent}, **value)
TypeError: __init__() got an unexpected keyword argument 'conf'
Steps to Reproduce
Just execute this code:
from aiogram import types
buttons = ['текст', 'текст', 'текст', 'текст', 'текст', 'текст','текст', 'текст','текст', 'текст', 'текст', 'текст','текст', 'текст']
markup = types.ReplyKeyboardMarkup(row_width=4, resize_keyboard=True)
markup.add(types.KeyboardButton('текст'))
markup.add(types.KeyboardButton('текст'))
markup.add(*buttons) # or *(types.KeyboardButton(i) for i in buttons), no matter
dict_kb = markup.to_python()
types.ReplyKeyboardMarkup.to_object(dict_kb) # error
Expected Behavior
I wanna put a reply keyboard object into the redis storage, but it's impossible. I saw
to_python()
method of theReplyKeyboardMarkup
object and decided that I'll use that method to serialize the object in the redis storage and I'll useto_object(data)
method to get the keyboard from the redis storage and back it to object.Current Behavior
If I use the
KeyboardButton
object forReplyKeyboarkMarkup.add()
method, it'll return an error when I doto_object()
If I don't use that and just put a string into
ReplyKeyboarkMarkup.add()
method, it'll works fine without any error.Failure Information (for bugs)
Steps to Reproduce
Just execute this code:
but
works fine
The text was updated successfully, but these errors were encountered: