def get(self, temp_id):
        """
        List all currently registered job templates
        """
        result = []
        if temp_id:
            try:
                template = Templates.query.filter_by(id=temp_id).first()
                temp_file = valid.val_filepath(path_string='{}templates/'.format(self.log_dir),
                                               file_string='{}.json'.format(template.id.hex))
                with temp_file.open('r') as fh_temp:
                    template = json.loads(fh_temp.read())
                    result.append(template)
            except AttributeError:
                abort(404)
            except Exception as err:
                logger.debug('Error getting job template details: {}'.format(err))
                return {'msg': 'API error fetching template details'}, 500
        else:
            try:
                for template in Templates.query.all():
                    try:
                        temp_file = valid.val_filepath(path_string='{}templates/'.format(self.log_dir),
                                                       file_string='{}.json'.format(template.id.hex))
                        with temp_file.open('r') as fh_temp:
                            temp = json.loads(fh_temp.read())
                            temp_dict = {
                                'Name': template.name,
                                'ID': template.id,
                                'Details': temp
                                }
                            result.append(temp_dict)
                    except FileNotFoundError as err:
                        logger.debug('Error getting job template: {}'.format(err))
            except AttributeError:
                abort(404)
            except Exception as err:
                logger.debug('Error getting job templates list: {}'.format(err))
                return {'msg': 'API error fetching template list'}, 500
        return jsonify(result), 200

        List all currently registered job templates
        
crackq/cq_api.py