我正在学习如何使用灯泡模型,我有关于Node类初始化的问题。
从文档中:
from bulbs.model import Node, Relationship
from bulbs.property import String, Integer, DateTime
from bulbs.utils import current_datetime
class Person(Node):
element_type = "person"
name = String(nullable=False)
age = Integer()如何在将数据保存到节点之前进行数据操作?
我可以执行类似这样的操作吗
class Person(Node):
element_type = "person"
name = String(nullable=False)
if name == "Bar":
name = "Foo"或者我必须覆盖Node init?
class Person(Node):
element_type = "person"
name = String(nullable=False)
def __init__(self, name):
if name == "Bar":
self.name = "Foo"发布于 2014-07-03 05:52:48
重写模型的_create()方法。
请参阅https://github.com/espeed/bulbs/blob/master/bulbs/model.py#L565
另请参阅“自定义灯泡模型示例”:
Is there a equivalent to commit in bulbs framework for neo4j
https://stackoverflow.com/questions/24527369
复制相似问题