Plone This page does not seem to exist…

Hi,

I am trying to following along with this tutorial I've created my dexterity content type and the default view for it works correctly but I can't seem to get it to work with a custom view

here is the relevant part of the confgure.zcml

<browser:page
        name="view"
        for=".content.custom_client.ICustomClient"
        class=".content.custom_client.CustomClientView"
        template="content/custom_client.pt"
        permission="zope2.View"
        />

CustomClientView (in custom_client.py)-

class CustomClientView(BrowserView):
    def sesions(self):
        context = aq_inner(self.context)
        catalog = api.portal.get_tool(name="portal_catalog")

        return catalog(
            object_provides=ICustomClient.__identifier__,
            path='/'.join(context.getPhysicalPath()),
            sort_on='sortable_title'
        )

and this is what my folder structure looks like

image

and this is the error message I'm seeing for
http://localhost:8080/Plone/custom-client-folder/my-custom-client

I've tried to change the path to the template a few times but then I get and error message when running plonectl fg that 'the template file cannot be found'

Does everything look correct with how I have this configured?

Thanks!

1 Like

Have you run a buildout? Can you post your Contenttype Definition? portal_types fti and the content class? What happen if you change the name of view to my-example and http://localhost:8080/Plone/custom-client-folder/my-custom-client/@@my-example ? What happen if you call http://localhost:8080/Plone/custom-client-folder/my-custom-client/@@view ?

Attempted bin/buildout, didn't have any effect I'm still getting that 'page not found'

here is the contenttype defintion -

Not sure which part of the portal_types -> fti is important here are the view options


Let me know if a specific setting would be important to see...

Tried changing the view to be my-example -

<browser:page
        name="my-example"
        for=".content.custom_client.ICustomClient"
        class=".content.custom_client.CustomClientView"
        template="content/custom_client.pt"
        permission="zope2.View"
        />

.../my_custom_client
Shows the default view now
image

Then going to .../my_custom_client/@@my-example
gives me the 'page does not seem to exist'

Please check this:

from plone.dexterity.browser.view import DefaultView

class CustomClientView(DefaultView):
    ....

Taken from a custom project:

<!-- configure.zcml -->
  <browser:page
    name="view"
    for="my.addon.interfaces.IVideoLecture"
    class="my.addon.browser.views.VideoLectureView"
    layer="my.addon.interfaces.IMyAddonLayer"
    template="templates/video-lecture-view.pt"
    permission="zope2.View" />
# views.py
class VideoLectureView(DefaultView):
    def __call__(self):
        return super(VideoLectureView, self).__call__()
Folder Structure:
my.addon/interfaces.py
my.addon/browser/views.py
my.addon/browser/configure.zcml
my.addon/browser/templates/video-lecture-view.pt

If i override a view with name "view" or other default views like 'listing', 'tabular_view'... i use ever the layer directive

Made some progress with this,

Configure.zcml now looks like

    <browser:page
        name="view"
        for=".content.custom_client.ICustomClient"
        class=".content.custom_client.CustomClientView"
        template="./browser/templates/custom_client.pt"
        permission="zope2.View"
        />

I was still having issues, I replaced my custom_client.pt with just


<html>
<body>
    <p>Something</p>
</body>
</html>

and now http://localhost:8080/Plone/custom-client-folder/my-custom-client does correctly display that template file, so it must have been an issue in the template file, very odd error message for it to display in Plone though

please look in the logfile, there should be more to learn

Where do those log files get saved to?

default for non-zeo installation in: your-buildout-dir/var/log/instance.log

or

default for a zeo-installation:
your-buildout-dir/var/clientX/event.log

or

whatever is configure in your buildout :wink:

or

if you start your instance via bin/instance fg then you see the output in your console

I was wondering if it would be any different than the output in the console, I didn't see anything in the logs/console that was specifically about it not finding the page...

I just starting commenting things out and found the culprit

<!-- <div class="discreet">
            <tal:block condition="context/start">
                <span i18n:translate="label_from">From:</span>
                <span tal:content="python:context.start.strftime('%x %X')" />
            </tal:block>
            <tal:block condition="context/end">
                <span i18n:translate="label_to">To:</span>
                <span tal:content="python:context.end.strftime('%x %X')" />
            </tal:block>
        </div> -->

and

<!-- <div tal:content="structure context/details/output" /> -->

once those were commented out, everything started to work

It was to much copy&paste from the example. You should only use your defined fields in the template or methods of your view.