+1 on pulling the "random_password()" method out of the Class and setting
it up as a module object.
I'd still suggest using this sort of an import statement on it, though:

from myproject.myapp.helpers import random_password

Where in this example you'd substitute your Project name with "myproject",
the app name with "myapp" and the this particular python file with
"helpers.py".

On Fri, Jun 22, 2012 at 10:54 AM, Daniel Roseman <dan...@roseman.org.uk>wrote:

> On Friday, 22 June 2012 15:49:31 UTC+1, aid wrote:
>>
>>
>> Hi Emily,
>>
>> On 22 Jun 2012, at 15:46, Emily wrote:
>>
>> > This is the class I created...
>> >
>> > import string
>> > import random
>> >
>> > class Helpers:
>> >
>> >     def random_password():
>>
>> Take random_password outside of the Helpers class and you should be OK.
>>  On the import statement you need to refer to a 'top level object' within
>> the imported file.  The only top level object you have is the class
>>  Helpers - which it doens't look like you really need.
>>
>> Cheers,
>>
>> aid
>>
>>
> +1. Python is not Java. Don't use a class unless you're encapsulating data.
> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/eV6jxgDm7cgJ.
>
> 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.
>

-- 
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