Beispiel #1
0
Datei: misc.py Projekt: azam/mm
    def execute(self):
        if 'username' not in self.params or self.params['username'] == None or self.params['username'] == '':
            raise MMException('Please enter a Salesforce.com username')
        if 'password' not in self.params or self.params['password'] == None or self.params['password'] == '':
            raise MMException('Please enter a Salesforce.com password')
        if 'org_type' not in self.params or self.params['org_type'] == None or self.params['org_type'] == '':
            raise MMException('Please select an org type')
        if 'org_type' in self.params and self.params['org_type'] == "custom" and "org_url" not in self.params:
            raise MMException('To use a custom org type, please include a org_url parameter') 
        if 'org_type' in self.params and self.params['org_type'] == "custom" and "org_url" in self.params and self.params["org_url"] == "":
            raise MMException('Please specify the org url')    

        client = MavensMateClient(credentials={
            "username" : self.params['username'],
            "password" : self.params['password'],
            "org_type" : self.params['org_type'],
            "org_url"  : self.params.get('org_url', None)
        }) 
        
        response = {
            "sid"                   : client.sid,
            "user_id"               : client.user_id,
            "metadata_server_url"   : client.metadata_server_url,
            "server_url"            : client.server_url,
            "metadata"              : client.get_org_metadata(subscription=self.params.get('subscription', None)),
            "success"               : True
        }
        return util.generate_response(response)
Beispiel #2
0
    def execute(self):
        if 'username' not in self.params or self.params['username'] == None or self.params['username'] == '':
            raise MMException('Please enter a Salesforce.com username')
        if 'password' not in self.params or self.params['password'] == None or self.params['password'] == '':
            raise MMException('Please enter a Salesforce.com password')
        if 'org_type' not in self.params or self.params['org_type'] == None or self.params['org_type'] == '':
            raise MMException('Please select an org type')
        if 'org_type' in self.params and self.params['org_type'] == "custom" and "org_url" not in self.params:
            raise MMException('To use a custom org type, please include a org_url parameter') 
        if 'org_type' in self.params and self.params['org_type'] == "custom" and "org_url" in self.params and self.params["org_url"] == "":
            raise MMException('Please specify the org url')    

        config.logger.debug('=================>')
        config.logger.debug(self.params)

        client = MavensMateClient(credentials={
            "username" : self.params['username'],
            "password" : self.params['password'],
            "org_type" : self.params['org_type'],
            "org_url"  : self.params.get('org_url', None)
        }) 
        
        response = {
            "sid"                   : client.sid,
            "user_id"               : client.user_id,
            "metadata_server_url"   : client.metadata_server_url,
            "server_url"            : client.server_url,
            "metadata"              : client.get_org_metadata(subscription=self.params.get('subscription', None)),
            "org_metadata_types"    : util.metadata_types(),
            "success"               : True
        }
        return util.generate_response(response)