On Mon, Mar 9, 2009 at 11:11 AM, Julián C. Pérez <jcp...@gmail.com> wrote:

>
> hi everyone from colimbia
> i'm new on django... so far, i love it... i'm very used to php, but
> the solution with django/python is just awesome
> i have started a project and i've been catching up with the basics...
> right now i have 2 doubts...
>
> 1. i created a file called 'globalValues.py' in the root folder of my
> project... the purpose?? to put in there all python functions created
> by me and called frequently among the code, and also to put some html
> 'shortcuts' to common stuff...
> the code in that file so far is next:
> # ----------
> # start code globalValues.py
> def ocultarEstado(request):
>        return { 'ocultarEstado' : '<p>hi u user!</p>' }
> # end code
> # ----------
> very short right now jeje
> my question about it: how can i make 'ocultarEstado' function to
> output the string as html, instead of its raw representation??
>
> 2. said all above, in my 'settings.py' file there is the import as it
> follows:
> # ----------
> TEMPLATE_CONTEXT_PROCESSORS = (
>        'django.core.context_processors.auth',
>        'django.core.context_processors.debug',
>        'django.core.context_processors.i18n',
>        'django.core.context_processors.media',
>        'myproject.globalValues.ocultarEstado',
> )
> # ----------
> my question here: how can i import all functions inside 'globalValues'
> file with one call?? -i'm looking for a "myproject.globalValues.*"
> kind of expression"- making every function calling with an entry is
> quite large...
>
> thank u all!
>
> >
>
You can do from myproject.globalValues import * which will add everything in
that namespace to your current one, however, in general, this is very
discouraged within Python, but you can do it if you like.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to