First time here? Check out the FAQ!

vikas.gulati's profile - activity

2013-08-09 21:46:53 -0500 received badge Famous Question (source)
2013-07-08 04:59:45 -0500 received badge Editor (source)
2013-07-08 04:57:51 -0500 commented answer Unable to integrate a 3rd party app template loader with askbot

Regarding mobile detection without the request object. That would be easily handled with the get_flavous() function provided by django_mobile (as it sets the flavour in middleware itself.)

2013-07-08 04:56:19 -0500 commented answer Unable to integrate a 3rd party app template loader with askbot

But I would need to keep my newly created loader (by subclassing askbot.skins.loaders.Loader) at the beginning of the TEMPLATE_LOADERS property and askbot won't allow any loader before the askbot.skins.loaders.Loader. Also there seems to be no way to turn off the startup tests and hence I won't be able to use my custom loader.

2013-07-03 10:21:29 -0500 asked a question Unable to integrate a 3rd party app template loader with askbot

I'm trying to integrate django_mobile with my askbot app. But I'm unable to integrate it because django_mobile's custom template_loader is not identified by coffin and is ignored.

It throws this warning UserWarning:

Cannot translate loader: django_mobile.loader.Loader

My TEMPLATE_LOADERS setting is something like this:

TEMPLATE_LOADERS = (
    'askbot.skins.loaders.Loader',
    'django_mobile.loader.Loader',
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader'
)

I have tried tracing it down and fixing it but haven't yet hit a solution. What I could workout so far is this.

Coffin translates each of the template loader into a corresponding Jinja loader and warns if it can't be translated. This is where the translation is done. Now coffin can't find a suitable translation for 'django_mobile.loader.Loader' as it only translates some specific loaders with jinja_loader_from_django_loader.

What could be done to solve this?

2013-07-03 10:02:23 -0500 received badge Famous Question (source)
2012-10-15 00:49:14 -0500 commented question View /settings/export is broken

whats the fix for this? your link returns 404!

2012-09-30 21:57:20 -0500 received badge Nice Question (source)
2012-09-27 12:31:43 -0500 received badge Supporter ( source )
2012-09-27 12:30:48 -0500 answered a question on trying to upvote again previous vote gets cancelled!

what i did was to override the process_vote method and change the line which says:

score_delta = vote.cancel()
response_data['count'] = post.score + score_delta
response_data['status'] = 1 #this means "cancel"

to this:

before_vote = vote.vote

if (before_vote<0 and vote_direction == 'up') or (before_vote>0 and vote_direction == 'down'):
    score_delta = vote.cancel()
    response_data['count'] = post.score + score_delta
    response_data['status'] = 1 #this means "cancel"
2012-09-27 12:27:21 -0500 commented question on trying to upvote again previous vote gets cancelled!

desired behavior should be that previous vote shall only be cancelled if my current vote and old vote are opposites otherwise it shouldn't.

to tackle this situation i had to override the process_vote method and added a check before vote.cancel() as mentioned below in my answer.

2012-09-27 12:10:58 -0500 received badge Student (source)
2012-09-27 08:58:47 -0500 asked a question on trying to upvote again previous vote gets cancelled!

when i try to upvote a post that i have upvoted previously the previous vote gets cancelled and score gets reduced.

same problem occurs when i try to downvote a post that i have previously downvoted. Is this the desired behavior?