Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Error rendering, is it the intended functionality?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mohammad Naghavi  
View profile  
 More options Sep 14 2012, 4:43 am
From: Mohammad Naghavi <moham...@gmail.com>
Date: Fri, 14 Sep 2012 10:43:32 +0200
Local: Fri, Sep 14 2012 4:43 am
Subject: Error rendering, is it the intended functionality?

Hi,
I'm dealing with an action of a controller, in which no db interaction is
required until it comes to rendering the view. inside the view, again first
half of the view doesn't need any db interactions until a form creation is
started somewhere in the middle. I'm preparing my app for production
environment so I came to the point to make it clean. there I tested the
situation in which DB is shut down and pointed the browser to that action,
what I expected was a single internal error page, but what I got was a half
rendered view, which was accompanied with the rendered error layout.
something like following:

    <h4 class="warning">        some message here    </h4>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html
xmlns="http://www.w3.org/1999/xhtml"><head>  <meta
http-equiv="Content-Type" content="text/html; charset=utf-8"
/>   <title>           CakePHP: the rapid development php
framework:              Errors  </title>  <link href="/itbs/favicon.ico
<view-source:http://localhost/itbs/favicon.ico>" type="image/x-icon"
rel="icon" /><link href="/itbs/favicon.ico
<view-source:http://localhost/itbs/favicon.ico>" type="image/x-icon"
rel="shortcut icon" /><link rel="stylesheet" type="text/css"
href="/itbs/css/cake.generic.css
<view-source:http://localhost/itbs/css/cake.generic.css>"
/></head><body>  <div id="container">

...

now my question is that how to remove this first part of half rendered view?
I tried to set $this->response->body(' '); on beforeRender of the
appController for the case that controller->name is CakeError but it didn't
work, any other suggestions?

regards,
MN


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
lowpass  
View profile  
 More options Sep 14 2012, 1:57 pm
From: lowpass <zijn.digi...@gmail.com>
Date: Fri, 14 Sep 2012 13:57:10 -0400
Local: Fri, Sep 14 2012 1:57 pm
Subject: Re: Error rendering, is it the intended functionality?
Are you making DB queries from within the View? You should be doing so
from the model or controller. Then, once the controller has all the
data it requires, it passes it to View to be rendered.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mohammad Naghavi  
View profile  
 More options Sep 16 2012, 6:19 am
From: Mohammad Naghavi <moham...@gmail.com>
Date: Sun, 16 Sep 2012 12:19:04 +0200
Local: Sun, Sep 16 2012 6:19 am
Subject: Re: Error rendering, is it the intended functionality?

Hi,
I do no query from inside the View, I just call this:
$this->Form->create();
inside my view. the problem is that every thing inside view before this
line comes as a part of the exception handling output.
what I think is that because I don't call any db or model related actions
inside the controller, the exception is thrown and caught at the point that
form creation is triggered, where the cake tries to connect to db.

anyway I managed to solve my problem using a custom error controller. but I
think it is good for core developers to know the situation.

regards,
MN


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Léo Willian Kölln  
View profile  
 More options Sep 16 2012, 12:43 pm
From: Léo Willian Kölln <leoko...@gmail.com>
Date: Sun, 16 Sep 2012 13:43:32 -0300
Local: Sun, Sep 16 2012 12:43 pm
Subject: Re: Error rendering, is it the intended functionality?
Why there is some DB interaction during the View rendering? You dont
need to do any query "explicitly" on the View file, if you are calling
a method that does some DB interaction you are doing a Query during
the View Context.
If you need some data that comes from model (doesn't matter if it is
from DB or not), do it on the controller, setting variables to output
them on the View.

Can someone confirm my conclusion?

Léo Willian Kölln


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
lowpass  
View profile  
 More options Sep 17 2012, 1:42 pm
From: lowpass <zijn.digi...@gmail.com>
Date: Mon, 17 Sep 2012 13:41:42 -0400
Local: Mon, Sep 17 2012 1:41 pm
Subject: Re: Error rendering, is it the intended functionality?
I think I see the problem. It's not that Mohammad is explicitly
querying the DB from the View, but that FormHelper is doing so behind
the scenes. It fetches the model's schema. In this case the DB is
unavailable and it's not being handled well.

It's odd that the error message (inside the H4$ tags) is spit out
before even the doctype. Perhaps that's a clue as to what's going on.

On Sun, Sep 16, 2012 at 12:43 PM, Léo Willian Kölln <leoko...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mohammad Naghavi  
View profile  
 More options Sep 18 2012, 12:35 pm
From: Mohammad Naghavi <moham...@gmail.com>
Date: Tue, 18 Sep 2012 18:35:01 +0200
Local: Tues, Sep 18 2012 12:35 pm
Subject: Re: Error rendering, is it the intended functionality?

lowpass, thats it. the problem is that FormHelper fetches the model data
inside the view. I don't know why this is the case, but as said, I managed
to solve the problem but I don't think it should be like that. it will be
interesting for the Cake developers to know however.

regards,
Mohammad


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
lowpass  
View profile  
 More options Sep 18 2012, 1:26 pm
From: lowpass <zijn.digi...@gmail.com>
Date: Tue, 18 Sep 2012 13:26:31 -0400
Local: Tues, Sep 18 2012 1:26 pm
Subject: Re: Error rendering, is it the intended functionality?
Just to clarify for anyone reading this, adding $useTable = false to
the model is not the solution. Mohammad mentioned that he was testing
"the situation in which DB is shut down" and how Cake would handle it.

I've just confirmed with 2.1.3 that the error page comes up ("Internal
error has occurred") but that the header in my view -- just before the
Form->create() line -- is displayed at the top of the page, just as in
Mohammad's example. So it seems like a buffering problem.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »