'Get the path to the view template
@param r: the S3Request
@param default: name of the default view template'

@staticmethod
def _view(r, default):

    folder = r.folder
    prefix = r.controller
    exists = os.path.exists
    join = os.path.join
    settings = current.deployment_settings
    theme = settings.get_theme()
    location = settings.get_template_location()
    if (theme != 'default'):
        view = join(folder, location, 'templates', theme, 'views', ('%s_%s_%s' % (prefix, r.name, default)))
        if exists(view):
            return open(view, 'rb')
        else:
            if ('/' in default):
                (subfolder, _default) = default.split('/', 1)
            else:
                subfolder = ''
                _default = default
            if exists(join(folder, location, 'templates', theme, 'views', subfolder, ('_%s' % _default))):
                if subfolder:
                    subfolder = ('%s/' % subfolder)
                current.response.s3.views[default] = ('../%s/templates/%s/views/%s_%s' % (location, theme, subfolder, _default))
    if r.component:
        view = ('%s_%s_%s' % (r.name, r.component_name, default))
        path = join(folder, 'views', prefix, view)
        if exists(path):
            return ('%s/%s' % (prefix, view))
        else:
            view = ('%s_%s' % (r.name, default))
            path = join(folder, 'views', prefix, view)
    else:
        view = ('%s_%s' % (r.name, default))
        path = join(folder, 'views', prefix, view)
    if exists(path):
        return ('%s/%s' % (prefix, view))
    else:
        return default
