mirror of
https://github.com/wassname/pyramid_formalchemy.git
synced 2026-07-19 11:27:04 +08:00
nicer repr(actions)
This commit is contained in:
@@ -248,7 +248,7 @@ class Actions(list):
|
||||
>>> actions = Actions('pyramid_formalchemy.actions.delete',
|
||||
... Link('link1', content=_('A link'), attrs={'href':'request.application_url'}))
|
||||
>>> actions
|
||||
[<UIButton delete>, <Link link1>]
|
||||
<Actions [<UIButton delete>, <Link link1>]>
|
||||
|
||||
You must use a request to render them::
|
||||
|
||||
@@ -265,9 +265,7 @@ class Actions(list):
|
||||
|
||||
>>> new_actions = Actions('pyramid_formalchemy.actions.new') + actions
|
||||
>>> new_actions
|
||||
[<UIButton new>, <UIButton delete>, <Link link1>]
|
||||
>>> isinstance(new_actions, Actions)
|
||||
True
|
||||
<Actions [<UIButton new>, <UIButton delete>, <Link link1>]>
|
||||
|
||||
"""
|
||||
tag = u''
|
||||
@@ -282,6 +280,9 @@ class Actions(list):
|
||||
actions = list(self)+list(other)
|
||||
return self.__class__(*actions)
|
||||
|
||||
def __repr__(self):
|
||||
return '<%s %s>' % (self.__class__.__name__, list.__repr__(self))
|
||||
|
||||
|
||||
|
||||
class Languages(Actions):
|
||||
@@ -289,7 +290,7 @@ class Languages(Actions):
|
||||
|
||||
>>> langs = Languages('fr', 'en')
|
||||
>>> langs
|
||||
[<ListItem lang_fr>, <ListItem lang_en>]
|
||||
<Languages [<ListItem lang_fr>, <ListItem lang_en>]>
|
||||
|
||||
It take care about the active language::
|
||||
|
||||
|
||||
Reference in New Issue
Block a user