def page_for_path(self, path, raise404=False):
        """
        Return a page for a path. Optionally raises a 404 error if requested.

        Example::

            Page.objects.page_for_path(request.path)
        """

        stripped = path.strip("/")

        try:
            page = self.active().get(_cached_url="/%s/" % stripped if stripped else "/")

            if not page.are_ancestors_active():
                raise self.model.DoesNotExist("Parents are inactive.")

            return page

        except self.model.DoesNotExist:
            if raise404:
                raise Http404()
            raise

        Return a page for a path. Optionally raises a 404 error if requested.

        Example::

            Page.objects.page_for_path(request.path)
        
feincms/module/page/models.py