Ejemplo n.º 1
0
 def __init__(self, db):
     DBUtil.__init__(self, db)
     self.collection = db.Machine
     self.passHelper = PasswordHelper.PasswordHelper(key)
     self.userdb = Users.Users(db)
     self.roleDb = Role.Role(db)
     self.tagDB = Tags.Tags()
     # indexes
     self.collection.create_index([('username', ASCENDING),
                                   ('host', ASCENDING)],
                                  unique=True)
Ejemplo n.º 2
0
 def __init__(self, db):
     '''
     General description:
     This function initializes the database variables and \
     index to refer in functions.
     '''
     DBUtil.__init__(self, db)
     self.collection = db.Tool
     self.versionsDB = Versions.Versions(db)
     self.tagDB = Tags.Tags()
     # indexes
     self.collection.create_index([('name', ASCENDING)], unique=True)
     self.collection.create_index([('tag', ASCENDING)], unique=False)
Ejemplo n.º 3
0
 def __init__(self):
     '''
        General description:
        This function initializes the database variables and \
        index to refer in functions.
     '''
     db = mongodb
     DBUtil.__init__(self, db)
     self.collection = db.DeploymentUnit
     self.deploymentUnitApprovalStatusDB = DeploymentUnitApprovalStatus.DeploymentUnitApprovalStatus(
     )
     self.tagDB = Tags.Tags()
     self.buildDB = Build.Build()
     self.deploymentFieldsDB = DeploymentFields.DeploymentFields(db)
     self.deploymentUnitTypeDB = DeploymentUnitType.DeploymentUnitType()
     self.statedb = State.State(db)
     # self.deploymentUnitSetDB = DeploymentUnitSet.DeploymentUnitSet()
     # indexes
     self.collection.create_index([('name', ASCENDING)], unique=True)
Ejemplo n.º 4
0
    def ParseFile(self, filename, className):

        f = open(filename, 'r', encoding='utf8')
        doc = f.read()
        f.close()

        xmlDocument = xml.dom.minidom.parseString(doc)

        mainChildNode = xmlDocument._get_firstChild()
        className = mainChildNode.localName

        #initialize the dictionary for the corresponding document
        self.documentDict[className] = []

        for node in mainChildNode.childNodes:
            if node.localName == 'row':  #some nodes are None

                if className == 'badges':
                    badges = bdg.Badges()
                    badges.parse(node)
                    self.documentDict[className].append(badges)

                    pass
                elif className == 'comments':
                    comments = cmts.Comments()
                    comments.parse(node)
                    self.documentDict[className].append(comments)

                    pass
                elif className == 'posthistory':
                    postHistory = phist.PostHistory()
                    postHistory.parse(node)
                    self.documentDict[className].append(postHistory)
                    pass
                elif className == 'postlinks':
                    postLinks = plink.PostLinks()
                    postLinks.parse(node)
                    self.documentDict[className].append(postLinks)
                    pass
                elif className == 'posts':
                    post = posts.Posts()
                    post.parse(node)
                    self.documentDict[className].append(post)
                    pass
                elif className == 'tags':
                    tag = tags.Tags()
                    tag.parse(node)
                    self.documentDict[className].append(tag)
                    pass
                elif className == 'users':
                    user = users.Users()
                    user.parse(node)
                    self.documentDict[className].append(user)
                    pass
                elif className == 'votes':
                    vote = votes.Votes()
                    vote.parse(node)
                    self.documentDict[className].append(vote)
                    pass
                else:
                    raise "Error"
Ejemplo n.º 5
0
 def AddMissingChildren(self):
     # add tags
     self.tags = Tags.Tags()
     self.Add(self.tags)
Ejemplo n.º 6
0
def CreateTags(): return Tags.Tags()
def CreateTag(): return Tag.Tag()