mirror of https://github.com/veops/cmdb.git
fix
This commit is contained in:
parent
41cbc1e5b8
commit
b3d5557bc7
|
@ -10,6 +10,7 @@ from flask import request
|
|||
from flask import g
|
||||
from flask.ext.babel import Babel
|
||||
from flask.ext.principal import identity_loaded
|
||||
from flask.ext.principal import Principal
|
||||
|
||||
import core
|
||||
from extensions import db
|
||||
|
@ -78,7 +79,7 @@ def configure_blueprints(app, modules):
|
|||
|
||||
|
||||
def configure_identity(app):
|
||||
|
||||
principal = Principal(app)
|
||||
@identity_loaded.connect_via(app)
|
||||
def on_identity_loaded(sender, identity):
|
||||
g.user = User.query.from_identity(identity)
|
||||
|
|
|
@ -104,7 +104,8 @@ def delete_attribute(attr_id=None):
|
|||
@attribute.route("/citype/<int:type_id>", methods=["GET"])
|
||||
def get_attributes_by_type(type_id=None):
|
||||
manager = CITypeAttributeManager()
|
||||
from models.cmdb import CITypeCache, CIAttributeCache
|
||||
from models.attribute import CIAttributeCache
|
||||
from models.ci_type import CITypeCache
|
||||
|
||||
t = CITypeCache.get(type_id)
|
||||
if not t:
|
||||
|
|
|
@ -152,6 +152,7 @@ class AttributeManager(object):
|
|||
choice_table = type_map["choice"].get(attr.value_type)
|
||||
db.session.query(choice_table).filter(
|
||||
choice_table.attr_id == attr_id).delete()
|
||||
db.session.flush()
|
||||
name = attr.attr_name
|
||||
CIAttributeCache.clean(attr)
|
||||
db.session.delete(attr)
|
||||
|
|
Loading…
Reference in New Issue