def update_from_form(cls, form, user, password): uids = form.skills.data.split(',') fluid.login(user, password) fluid.post('/tags/%s' % user, {'name': 'skill', 'description': 'My skills', 'indexed': False}) fluid.delete('/values', query="has %s/skill" % user, tags=["%s/skill" % user]) for uid in uids: resp = fluid.put('/objects/%s/%s/skill' % (uid, user), None) if not resp or (resp and resp.status_code != 204): logging.warning("PUT /objects/%s/%s/skill failed!" % (uid,user)) fluid.logout()
def setUpClass(cls): fluid.login(USERNAME, PASSWORD) # create necessary tags rpcs = [] for cls in [Person, Education, Work]: for tag in cls.TAGS: rpc = fluid.post('/tags/test', async=True, body={'name' : tag, 'description' : None, 'indexed' : True}) rpcs.append(rpc) for rpc in rpcs: resp = fluid.result(rpc) if resp.status_code not in [201, 412]: print 'Failed to create tag: %s' % tag print resp.headers sys.exit(1) fluid.logout()
def create_object(about): fluid.login('fluidcv', app.config['FLUIDCV_PASSWORD']) resp = fluid.post('/objects', about) fluid.logout() return resp