(self, userdata, rdb)
Given-

        userdata = {
            "username": "foo",
            "password": "foo_password",
            "email": "foo@bar.com",
            "company": "foobar",
            "contact": "foo@bar.com""
        }

        - create a new user in the RethinkDB database
Given-
Given -
def createUser(self, userdata, rdb):
        '''
        Given-

        userdata = {
            "username": "foo",
            "password": "foo_password",
            "email": "foo@bar.com",
            "company": "foobar",
            "contact": "foo@bar.com""
        }

        - create a new user in the RethinkDB database
        '''
        jsondata = {}
        jsondata['username'] = userdata['username']
        jsondata['password'] = self.createPass(userdata['password'])
        jsondata['email'] = userdata['email']
        jsondata['status'] = 'active'
        jsondata['company'] = userdata['company']
        jsondata['acttype'] = self.config['DEFAULT_PACKAGE']
        jsondata['contact'] = userdata['contact']
        jsondata['stripe'] = self.stripe
        jsondata['stripeid'] = self.stripeid
        jsondata['subplans'] = self.subplans
        jsondata['payments'] = self.config['DEFAULT_PAYMENTS']
        jsondata['subscription'] = self.config['PACKAGES'][self.config['DEFAULT_PACKAGE']]['subscription']
        jsondata['subscribed_to_newsletter'] = self.subscribed_to_newsletter
        jsondata['creation_time'] = time.time()
        jsondata['confirmed'] = False

        if self.is_active(userdata['username'], rdb):
            return 'exists'
        else:
            results = r.table('users').insert(jsondata).run(rdb)
            if results['inserted'] == 1:
                return results['generated_keys'][0]
            else:
                return False
def createUser ( self , userdata , rdb ) : jsondata = { } jsondata [ 'username' ] = userdata [ 'username' ] jsondata [ 'password' ] = self . createPass ( userdata [ 'password' ] ) jsondata [ 'email' ] = userdata [ 'email' ] jsondata [ 'status' ] = 'active' jsondata [ 'company' ] = userdata [ 'company' ] jsondata [ 'acttype' ] = self . config [ 'DEFAULT_PACKAGE' ] jsondata [ 'contact' ] = userdata [ 'contact' ] jsondata [ 'stripe' ] = self . stripe jsondata [ 'stripeid' ] = self . stripeid jsondata [ 'subplans' ] = self . subplans jsondata [ 'payments' ] = self . config [ 'DEFAULT_PAYMENTS' ] jsondata [ 'subscription' ] = self . config [ 'PACKAGES' ] [ self . config [ 'DEFAULT_PACKAGE' ] ] [ 'subscription' ] jsondata [ 'subscribed_to_newsletter' ] = self . subscribed_to_newsletter jsondata [ 'creation_time' ] = time . time ( ) jsondata [ 'confirmed' ] = False if self . is_active ( userdata [ 'username' ] , rdb ) : return 'exists' else : results = r . table ( 'users' ) . insert ( jsondata ) . run ( rdb ) if results [ 'inserted' ] == 1 : return results [ 'generated_keys' ] [ 0 ] else : return False