First time here? Check out the FAQ!

matigro's profile - activity

2018-08-24 12:56:24 -0500 received badge Famous Question (source)
2018-08-24 12:56:24 -0500 received badge Notable Question (source)
2018-08-24 12:56:24 -0500 received badge Popular Question (source)
2017-06-19 18:15:44 -0500 received badge Notable Question (source)
2014-08-21 02:29:23 -0500 received badge Popular Question (source)
2013-07-24 08:46:20 -0500 answered a question Translate email to a specific language

Hi, well. I still couldn't translate it, but I think I'm near :)

What I did was copy the language function from Django 1.5 version to a new file in askbot/templatetags directory (askbot 0.7.48).

But when I try to import the template, it fails with this message:

TemplateSyntaxError: Encountered unknown tag 'language'. Jinja was looking for the following tags: 'endblock'. The innermost block that needs to be closed is 'block'.

This is what I have: In instant_notification.py:

{% block subscription %}
{% load i18n_customized %}

{% language "es" %}
    Hello World
{% endlanguage %}
{%endblock%}

And I've got a i18n_customized.py with the function:

@register.tag
def language(parser, token):
    """
    This will enable the given language just for this block.

    Usage::

    {% language "de" %}
    This is {{ bar }} and {{ boo }}.
    {% endlanguage %}

    """
    ... (the same code as in i18n.py) ...
    return LanguageNode(nodelist, language)

Also, I tried with

register.tag('language', language)

I debugged the code and the function is registered in the system.

For what I see, is something related to Jinja, but I don't know how to resolve it.

Any help is welcome

Traceback:

In [1]: from django.template.loader import get_template

In [2]: get_template('email/instant_notification.html')

TemplateSyntaxError                       Traceback (most recent call last)
<ipython-input-2-20bfe4850f9a> in <module>()
----> 1 get_template('email/instant_notification.html')

Cut all stack for get_template called

...askbot-src/askbot/skins/loaders.pyc in get_askbot_template(template, request)
    112     if hasattr(request,'LANGUAGE_CODE'):
    113         skin.set_language(request.LANGUAGE_CODE)
--> 114     return skin.get_template(template)
    115 
    116 def render_into_skin_as_string(template, data, request):

...local/lib/python2.7/site-packages/jinja2/environment.pyc in get_template(self, name, parent, globals)
    789         if parent is not None:
    790             name = self.join_path(name, parent)
--> 791         return self._load_template(name, self.make_globals(globals))
    792 
    793     @internalcode

...local/lib/python2.7/site-packages/jinja2/environment.pyc in _load_template(self, name, globals)
    763                                          template.is_up_to_date):
    764                 return template
--> 765         template = self.loader.load(self, name, globals)
    766         if self.cache is not None:
    767             self.cache[name] = template

...local/lib/python2.7/site-packages/jinja2/loaders.pyc in load(self, environment, name, globals)
    393         for loader in self.loaders:
    394             try:
--> 395                 return loader.load(environment, name, globals)
    396             except TemplateNotFound:
    397                 pass

...local/lib/python2.7/site-packages/jinja2/loaders.pyc in load(self, environment, name, globals)
    123         # date) etc. we compile the template
    124         if code is None:
--> 125             code = environment.compile(source, name, filename)
    126 
    127         # if the bytecode cache is available and the bucket doesn't

...local/lib/python2.7/site-packages/jinja2/environment.pyc in compile(self, source, name, filename, raw, defer_init)
    552         except TemplateSyntaxError:
    553             exc_info = sys.exc_info()
--> 554         self.handle_exception(exc_info, source_hint=source)
    555 
    556     def compile_expression(self, source, undefined_to_none=True):

...local/lib/python2.7/site-packages/jinja2/environment.pyc in handle_exception(self, exc_info, rendered, source_hint)
    740             self.exception_handler(traceback)
    741         exc_type, exc_value, tb = traceback.standard_exc_info
--> 742         reraise(exc_type, exc_value, tb)
    743 
    744     def join_path(self, template, parent):

/home/mgieco/Desarrollos/askbot-src/askbot/templates/email/instant_notification.html in template()
     10 {% load i18n_customized %}
     11 
---> 12 {% language "es" %}
     13     Hello World
     14 {% endlanguage %}

TemplateSyntaxError ...
(more)
2013-07-22 13:36:40 -0500 asked a question Translate email to a specific language

Hi, I want to send instant emails translated to Spanish (My application is running in English)

I'm using Django 1.3.1 and I couldn't do it.

I read that in version 1.5 there is a tag language that force translation to a block. But 1.3.1 showed an error with that tag.

Any help is welcome.

2013-07-17 13:23:30 -0500 received badge Famous Question (source)
2013-06-04 10:16:17 -0500 commented question Cannot start a new project with askbot

Thanks for your inmediate response! It's working from github version.

2013-06-04 09:35:20 -0500 received badge Student (source)
2013-06-04 09:34:04 -0500 asked a question Cannot start a new project with askbot

Hello, I have a problem when I want to synced a new installation of askbot. I started a new project, following most of the http://askbot.org/en/question/10829/customizable-askbot-installation/ (this steps) but with this requirements: Django==1.3.1 and askbot==0.7.48.

This is what migration do:

$ python manage.py migrate askbot
WARNING!!! You are using a 'locmem' (local memory) caching backend,(...cut by me...)

relation "askbot_badgedata" does not exist
LINE 1: ..."."slug", "askbot_badgedata"."awarded_count" FROM "askbot_ba...
                                                             ^
Running migrations for askbot:
 - Migrating forwards to 0161_add_field__user_languages.
 > askbot:0013_add_response_count__to_user
FATAL ERROR - The following SQL query failed: ALTER TABLE "auth_user" ADD COLUMN "response_count" integer NOT NULL DEFAULT 0;
The error was: column "response_count" of relation "auth_user" already exists

probably already have column User.response_count
Error in migration: askbot:0013_add_response_count__to_user
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File "/home/mgieco/.virtualenvs/askbot/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager

(... cut the stacktrace by me...)

  File "/home/mgieco/.virtualenvs/askbot/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute
    return self.cursor.execute(query, args)
django.db.utils.DatabaseError: current transaction is aborted, commands ignored until end of transaction block

I can't figure out what the problem is. Any help is welcome.