Closed (fixed)
Project:
Flag
Version:
7.x-2.0-beta3
Component:
Views integration
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Aug 2010 at 02:33 UTC
Updated:
7 Nov 2010 at 01:20 UTC
Jump to comment: Most recent file
Comments
Comment #1
webchickOh, ok. Seems no Flag views integration is getting picked up at all. Bumping in priority.
First issue is flag_views_api() is still specifying 2.0, we need 3.0.
Then, when you clear the Views cache, you get this:
I replaced that with a call to http://api.drupal.org/api/function/filter_fallback_format/7. (and left a comment about this at http://api.drupal.org/api/constant/FILTER_FORMAT_DEFAULT/6#comment-4624)
This causes the Flag views to show up in the list, but for example /bookmarks is a 404. I re-saved the Flag view and it's now showing up, but there are still odd errors. I figured a straight-up export of the newly-saved view would help, but it appears flag.views_default.inc is doing some weird stuff to try and save on code, so I still need to look at that a bit more.
Anyway, here's an initial stab that gets us this far.
Comment #2
webchickA little closer. Now /user/%/bookmarks works as intended. /bookmarks is still telling me I haven't bookmarked anything even though I have, though.
Comment #3
webchickHm. But even still, neither of these are appearing on a fresh install. :( Only when I clear the views cache. And then I still have to save them each individually to get them to not 404.
Furthermore, I have absolutely no idea why that /bookmarks view is only showing empty text. The logic appears sound.
Query in D6:
Query in D7:
The only differences appear to be:
1. The D7 version of Views wraps the table names in {}s, like {node} and so on.
2. The where clause is WHERE (( (node.status <> 0) )) instead of just WHERE node.status <> 0, but apart from some stupid extra parentheses, it seems to match?
3. The D7 version includes the LIMIT clause
Need a hand on this one. :(
Comment #4
mooffie commentedIn D6's Views, modules that want to filter on the current user embed a '***CURRENT_USER***' string in the query and later Views substitutes it with the UID of the current logged in user. (This technique makes it possible to cache the query.)
But it seems this mechanism isn't yet in D7's Views. This should mean that Views' own "Is the logged in user" filter (CVS link) doesn't work. I did a very quick search in Views' issues but couldn't find a relevant discussion.
Comment #5
mooffie commented(I think my previous comment lacked context: I was explaining why the '/bookmarks' view can't work: because it uses the "***CURRENT_USER***" mechanism which isn't implemented in D7's Views (I do "grep -r CURRENT_USER ." and don't see it handled). So the output is an invalid SQL.)
Comment #6
webchickHm. Really?
It appears to be there, at least in my CVS checkout from a couple of days ago. But that's a good thought; if that wasn't being converted properly and ended up being "0" or some-such, that would certainly explain the results...
Comment #7
webchickHa. I tried turning on Devel query log and get this:
Wheeeeee... :P #376824: Query log displays dreaded Fatal error: Exception thrown without a stack frame in Unknown on line 0 on Views pages
Comment #8
webchickOk, talking to dereine in #drupal-views, and #812970: Get Views Query substitutions working is the upstream Views issue for the ***CURRENT_USER*** problem.
Comment #9
webchickIncidentally, your spidey sense about ***CURRENT_USER*** was right on, apparently this code exists in Views 7.x atm. ;)
Comment #10
dawehnerWRONG issue, sry
Comment #11
lpalgarvio commentedgetting same issue
Notice: Use of undefined constant FILTER_FORMAT_DEFAULT - assumed 'FILTER_FORMAT_DEFAULT' in flag_views_default_views() (line 261 of /drupal/sites/all/modules/evaluation/flag/includes/flag.views_default.inc).
flag-7.x-2.x-dev
September 3, 2010 - 13:09
Drupal 7 alpha6
Comment #12
mooffie commentedCommitted.
http://drupal.org/cvs?commit=440786
(I also committed an update to the 6.2 branch to use FILTER_FORMAT_DEFAULT where it didn't:
http://drupal.org/cvs?commit=440780)
Comment #13
mooffie commentedThis isn't needed. Our Views integration works without this change. (And we don't want to mislead developers reading our code that we use something of the new 3.0 API.)
Comment #14
mooffie commentedThey have fixed this. Hurray!
I've added a note to the release-notes saying that one should use Views from 2010-Oct-1 onward, to cover this issue.