Hi,

Thanks for the reference.
Access to the __doc__ property of a function is always done by first
importing the function and then calling the property.

What if I want to include the docstring of a function in the context
this same function returns?

should I simply import the views module again?

Or is there a simple way of referencing itself inside of my function?

I would like to be able to do something like this:

def myview(request):
    """
    My docstring
    """

    help = self.__doc__ #Obviously this does not work


On Feb 26, 3:43 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
> On Thu, Feb 26, 2009 at 7:23 AM, Stefan Tunsch <stun...@gmail.com> wrote:
>
> > Hi!
>
> > I have a site that is starting to be used by a growing number of users,
> > and I find myself in the need of creating some kind of user manual.
> > My first thought has been to use the docstrings with which I'm
> > documenting my code.
> > I've seen that django comes with a Documentation option in the admin
> > that pulls the docstrings present in your code.
>
> > My question is:
>
> > How can I use this in my own views?
> > Anyone has some experience with this issue?
> > What approach would be best.
>
> > Right now I'm not even capable of  placing the docstring of a view
> > inside of a variable of this same view in order to use it in my context...
>
> > Regards, Stefan
>
> > This occurs through introspection of view and template tags by using the
>
> docutils module and the __doc__ attribute on functions, you can see how it
> occurs 
> here:http://code.djangoproject.com/browser/django/trunk/django/contrib/adm...
>
> 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- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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