Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Coopdevs OCB mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Odoo
Coopdevs OCB mirror
Commits
b4209525
Commit
b4209525
authored
14 years ago
by
Julien Thewys
Browse files
Options
Downloads
Patches
Plain Diff
[FIX] Adapted yaml_tag to serialize custom tags in module recorder.
bzr revid: jth@openerp.com-20101018132907-9cnfm4yzn3w01gox
parent
da2bfac7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/tools/yaml_tag.py
+17
-3
17 additions, 3 deletions
bin/tools/yaml_tag.py
with
17 additions
and
3 deletions
bin/tools/yaml_tag.py
+
17
−
3
View file @
b4209525
...
@@ -4,6 +4,7 @@ import logging
...
@@ -4,6 +4,7 @@ import logging
class
YamlTag
(
object
):
class
YamlTag
(
object
):
"""
"""
Superclass for constructors of custom tags defined in yaml file.
Superclass for constructors of custom tags defined in yaml file.
__str__ are overriden in subclass and used for serialization in module recorder.
"""
"""
def
__init__
(
self
,
**
kwargs
):
def
__init__
(
self
,
**
kwargs
):
self
.
__dict__
.
update
(
kwargs
)
self
.
__dict__
.
update
(
kwargs
)
...
@@ -27,6 +28,8 @@ class Record(YamlTag):
...
@@ -27,6 +28,8 @@ class Record(YamlTag):
self
.
model
=
model
self
.
model
=
model
self
.
id
=
id
self
.
id
=
id
super
(
Record
,
self
).
__init__
(
**
kwargs
)
super
(
Record
,
self
).
__init__
(
**
kwargs
)
def
__str__
(
self
):
return
'
!record {model: %s, id: %s}:
'
%
(
str
(
self
.
model
,),
str
(
self
.
id
,))
class
Python
(
YamlTag
):
class
Python
(
YamlTag
):
def
__init__
(
self
,
model
,
severity
=
logging
.
WARNING
,
name
=
""
,
**
kwargs
):
def
__init__
(
self
,
model
,
severity
=
logging
.
WARNING
,
name
=
""
,
**
kwargs
):
...
@@ -34,6 +37,8 @@ class Python(YamlTag):
...
@@ -34,6 +37,8 @@ class Python(YamlTag):
self
.
severity
=
severity
self
.
severity
=
severity
self
.
name
=
name
self
.
name
=
name
super
(
Python
,
self
).
__init__
(
**
kwargs
)
super
(
Python
,
self
).
__init__
(
**
kwargs
)
def
__str__
(
self
):
return
'
!python {model: %s}: |
'
%
(
str
(
self
.
model
),
)
class
Menuitem
(
YamlTag
):
class
Menuitem
(
YamlTag
):
def
__init__
(
self
,
id
,
name
,
**
kwargs
):
def
__init__
(
self
,
id
,
name
,
**
kwargs
):
...
@@ -42,10 +47,13 @@ class Menuitem(YamlTag):
...
@@ -42,10 +47,13 @@ class Menuitem(YamlTag):
super
(
Menuitem
,
self
).
__init__
(
**
kwargs
)
super
(
Menuitem
,
self
).
__init__
(
**
kwargs
)
class
Workflow
(
YamlTag
):
class
Workflow
(
YamlTag
):
def
__init__
(
self
,
model
,
action
,
**
kwargs
):
def
__init__
(
self
,
model
,
action
,
ref
=
None
,
**
kwargs
):
self
.
model
=
model
self
.
model
=
model
self
.
action
=
action
self
.
action
=
action
self
.
ref
=
ref
super
(
Workflow
,
self
).
__init__
(
**
kwargs
)
super
(
Workflow
,
self
).
__init__
(
**
kwargs
)
def
__str__
(
self
):
return
'
!workflow {model: %s, action: %s, ref: %s}
'
%
(
str
(
self
.
model
,),
str
(
self
.
action
,),
str
(
self
.
ref
,))
class
ActWindow
(
YamlTag
):
class
ActWindow
(
YamlTag
):
def
__init__
(
self
,
**
kwargs
):
def
__init__
(
self
,
**
kwargs
):
...
@@ -80,10 +88,15 @@ class Eval(YamlTag):
...
@@ -80,10 +88,15 @@ class Eval(YamlTag):
def
__init__
(
self
,
expression
):
def
__init__
(
self
,
expression
):
self
.
expression
=
expression
self
.
expression
=
expression
super
(
Eval
,
self
).
__init__
()
super
(
Eval
,
self
).
__init__
()
def
__str__
(
self
):
return
'
eval(%s)
'
%
(
str
(
self
.
expr
,))
class
Ref
(
YamlTag
):
class
Ref
(
YamlTag
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
expr
=
"
False
"
,
*
args
,
**
kwargs
):
self
.
expr
=
expr
super
(
Ref
,
self
).
__init__
(
*
args
,
**
kwargs
)
super
(
Ref
,
self
).
__init__
(
*
args
,
**
kwargs
)
def
__str__
(
self
):
return
'
ref(%s)
'
%
(
str
(
self
.
expr
,))
class
IrSet
(
YamlTag
):
class
IrSet
(
YamlTag
):
def
__init__
(
self
):
def
__init__
(
self
):
...
@@ -166,4 +179,5 @@ def add_constructors():
...
@@ -166,4 +179,5 @@ def add_constructors():
yaml
.
add_constructor
(
u
"
!eval
"
,
eval_constructor
)
yaml
.
add_constructor
(
u
"
!eval
"
,
eval_constructor
)
yaml
.
add_multi_constructor
(
u
"
!ref
"
,
ref_constructor
)
yaml
.
add_multi_constructor
(
u
"
!ref
"
,
ref_constructor
)
yaml
.
add_constructor
(
u
"
!ir_set
"
,
ir_set_constructor
)
yaml
.
add_constructor
(
u
"
!ir_set
"
,
ir_set_constructor
)
add_constructors
()
add_constructors
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment