When I selected "none" for the node pages in the context settings page, I got a website fatal error.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | statuses_default_values-1514022-5.patch | 1.74 KB | 7twelve |
| #4 | statuses-allow_null_fields-1514022-4.patch | 813 bytes | venutip |
When I selected "none" for the node pages in the context settings page, I got a website fatal error.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | statuses_default_values-1514022-5.patch | 1.74 KB | 7twelve |
| #4 | statuses-allow_null_fields-1514022-4.patch | 813 bytes | venutip |
Comments
Comment #1
mathankumarc commentedI think the problem is there is no default value is set for selectors fields and for pages fields also default value is missing. I dunno whether we have the same problem in D6 also.
This is occurring always(whatever the value you are selecting for any context)
Comment #2
icecreamyou commentedThis is not an issue in D6. I am also confused as to why this is a problem in D7 since text columns in the database cannot have default values (supplying a default value causes errors in Postgres). Possibly this will need to be resolved by manually supplying a default value, being careful not to overwrite any previously specified value.
To clarify, is this just happening on specific context settings pages like admin/statuses/contexts/user, or is it happening on the general context page at admin/statuses/contexts too?
Comment #3
icecreamyou commentedWhile we're at it, let's add an explanation to the context configuration page about what it does. It seems to confuse a lot of people.
Comment #4
venutip commentedThe error occurs because there is no default value and the column is set to NOT NULL. Removing that restriction on the `selector` and `pages` fields allows you to save and update contexts.
I can't confirm that this makes contexts work as they should, because I'm not sure I understand this feature :) But it resolves the error (uninstall, apply patch, reinstall).
If they're not allowed to be NULL, then they should be marked as required on the form.
Comment #5
icecreamyou commented#4 is an acceptable solution I think, although the patch needs an update function. Note also:
I believe these cases (and possibly one or two others I missed) will cause E_STRICT errors if the value of the relevant property is null. I think that the most consistent solution here would be to manually set the 'selectors' and 'pages' attributes to '' (the empty string) in statuses_determine_context() if the values are null.
Comment #6
7twelve commentedFirst patch ever, so hopefully I've done this correctly :)
But, here's a patch to set pages and selectors to either an empty string, or a previously defined value as mentioned in #5. Also a small change on the user context views part, as it was looking at the option text rather than the value.
Comment #7
icecreamyou commented#6 is actually the ideal solution; committed to dev (with minor changes -- removed extra whitespace and redundant parentheses). Thanks!
This exposes another problem which we will address as a follow-up: #1675086: Saving the context configuration form for the first time makes the contexts out of order