TestCase.urls with templates that have url to other apps

2011-01-15 Thread Vitaly Babiy
 

class EmailNotificationTest(BaseTestCase):
"""
Test Class for testing email notification
"""
urls = 'notification.urls'


 

def test_create_notification(self):
res = self.client.get('email/create/) # will fail 
self.assertEquals(res.status_code, 200)


If I try to render a template that has {% url other-app-view %} I get a 
error. I am doing something wrong or is this by design?

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



Should namespaces be used to clean up url names

2011-01-15 Thread Vitaly Babiy
The url docs talks about naming urls like this: myapp-comment, does it make 
sense to do this still when we have namespaces? With a namespace we could do 
myapp:comment this way the url name only describes the view and has 
no reference to the application name that its in.

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



Mongo and the Admin

2010-11-01 Thread Vitaly Babiy
Hey guys,
I know there has been work done with nosql I was wondering if the admin
works with mongo yet?

Thank,
Vitaly Babiy

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Re: Django 1.2 release candidate available

2010-05-06 Thread Vitaly Babiy
Awesome Job, thanks everyone.
Vitaly Babiy


On Thu, May 6, 2010 at 2:53 PM, Nick Serra <nickse...@gmail.com> wrote:

> Awesome! Thanks so much!
>
> On May 6, 3:32 am, Federico Capoano <nemesis.des...@libero.it> wrote:
> > I've been using the beta for a while and it works pretty good for what
> > I've seen.
> >
> > On May 6, 6:40 am, James Bennett <ubernost...@gmail.com> wrote:
> >
> >
> >
> >
> >
> > > Tonight we're proud to announce, finally, the first Django 1.2 release
> > > candidate. If all goes well, it will also be the *only* release
> > > candidate, and Django 1.2 final will release one week from today.
> >
> > > For more information, consult:
> >
> > > * The Django project weblog:
> http://www.djangoproject.com/weblog/2010/may/05/12-rc-1/
> > > * The release notes:
> http://docs.djangoproject.com/en/dev/releases/1.2-rc-1/
> >
> > > --
> > > "Bureaucrat Conrad, you are technically correct -- the best kind of
> correct."
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups "Django users" group.
> > > To post to this group, send email to django-us...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> > > For more options, visit this group athttp://
> 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-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> > For more options, visit this group athttp://
> 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-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@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-us...@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.



Re: code repetition in views

2010-04-11 Thread Vitaly Babiy
Django provides a few decorators that remove alot of that repetitive code.

Check the auth section for the logged in decorator

Vitaly Babiy


On Sat, Apr 10, 2010 at 11:58 PM, ydjango <neerash...@gmail.com> wrote:

> I find all my view method have identical code in start and in end:
>
> anyway to avoid repetition...?
>
> Example:
>
> def typical_view_method(request):
>
>   Check if user is authenticated.
>   Get user and group
>   Get some session variables
>
>   try:
> Method specific logic
>   except Exception, e:
> view_logger.error('error in typical_view_method:%s', e)
>
>response = HttpResponse(json_data, mimetype = 'application/json')
>response.__setitem__('Cache-Control', 'no-store,no-cache')
>response.__setitem__('Pragma', 'no-cache')
>response.__setitem__('Expires', '-1')
>return response
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@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-us...@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.



Mailing list app

2010-02-11 Thread Vitaly Babiy
Hey guys,

Has any found a good application to send emails to your users? Like you want
to let all your user know of downtime.

Thanks
Vitaly Babiy

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Django Auth

2009-12-13 Thread Vitaly Babiy
Hey Guys,
Is there anything in the works to do some refactoring of django auth.
Because if you are using a custom user object all the django auth test
break.

Thanks,
Vitaly Babiy

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.




Re: djangocon videos

2009-11-10 Thread Vitaly Babiy
According to there twitter (http://twitter.com/djangocon/status/4680045261)
they should be up but who knows when.
Vitaly Babiy


On Tue, Nov 10, 2009 at 8:01 AM, Aljosa Mohorovic <
aljosa.mohoro...@gmail.com> wrote:

>
> will conference videos be available or did something terrible
> happened?
>
> Aljosa Mohorovic
> >
>

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



Re: Django and SSL Deployment using mod_wsgi

2009-10-15 Thread Vitaly Babiy
Hey take a look at this
http://www.howsthe.com/blog/2009/sep/20/djang-nginx-mod_wsgi-ssl/
Vitaly Babiy


On Thu, Oct 15, 2009 at 5:30 PM, neri...@gmail.com <neri...@gmail.com>wrote:

>
> I'm trying to do the same thing but I'm having problems getting nginx
> to server over https. I removed all 443 references for apache and
> added them to my nginx/sites-available/domain.com, so I have a
> declaration for static content listening on port 80 and then another
> for ssl on 443. I'm totally new to this so I'm a bit unsure what's
> wrong, do I need to add some WSGI reference to the nginx config, is
> there a ssl mod for nginx I need to enable?
>
> Thanks,
>
> Jason
>
> On Aug 31, 10:39 am, Francis <f.du...@gmail.com> wrote:
> > We setup aNginxproxy in front ofApache/WSGI and gotNginxto handle
> > theSSLcert and simply pass on a flag to WSGI if the connection was
> > coming through http or https.
> >
> > Next you'll want aSSLmiddleware, we use:
> http://www.djangosnippets.org/snippets/240/
> >
> > Now its a matter of configuring which views you wantSSL(follow
> > example in the middleware)
> >
> > On Aug 28, 11:04 pm, Vitaly Babiy <vbabi...@gmail.com> wrote:
> >
> > > Hey guys,
> > > What is the best way to deploy an app that uses mod_wsgi that some
> parts of
> > > it need to be behindSSL?
> >
> > > Thanks,
> > > Vitaly Babiy
> >
>

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



Re: djangocon videos

2009-10-14 Thread Vitaly Babiy
Yeah I would love to seem them too.
Vitaly Babiy


On Wed, Oct 14, 2009 at 10:44 AM, Aljosa Mohorovic <
aljosa.mohoro...@gmail.com> wrote:

>
> anybody knows when djangocon september/portland videos will be
> available?
>
> Aljosa Mohorovic
> >
>

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



Re: Automatic {% load %} ?

2009-10-04 Thread Vitaly Babiy
Hey take a look at this
http://stackoverflow.com/questions/1184983/load-a-django-template-tag-library-for-all-views-by-default
Vitaly Babiy


On Sun, Oct 4, 2009 at 10:07 PM, Christophe Pettus <x...@thebuild.com> wrote:

>
> In my templates, I'm making reasonably heavy use of custom tags.  Is
> there a way to avoid having to have the template authors put the {%
> load %} tags at the top of each template, since pretty much every
> single template is going to need to load the same set?
>
> --
> -- Christophe Pettus
>x...@thebuild.com
>
>
> >
>

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



Re: django-trunk/django directory problem

2009-09-26 Thread Vitaly Babiy
You have a simlink to the django directory. Just remove the django file.
Vitaly Babiy


On Sat, Sep 26, 2009 at 7:42 PM, Malcolm MacKinnon <mmack3...@gmail.com>wrote:

> Sure, here it is:
>
> malc...@baglux:~/django-trunk/django$ ls -al
> total 80
> drwxr-xr-x 18 malcolm malcolm 4096 2009-08-06 20:16 .
> drwxr-xr-x  9 malcolm malcolm 4096 2009-08-06 20:16 ..
> drwxr-xr-x  4 malcolm malcolm 4096 2009-04-30 04:47 bin
> drwxr-xr-x  7 malcolm malcolm 4096 2009-05-27 08:27 conf
> drwxr-xr-x 22 malcolm malcolm 4096 2009-04-30 05:30 contrib
> drwxr-xr-x  9 malcolm malcolm 4096 2009-08-06 20:17 core
> drwxr-xr-x  5 malcolm malcolm 4096 2009-04-30 05:30 db
> drwxr-xr-x  3 malcolm malcolm 4096 2009-05-27 08:27 dispatch
> lrwxrwxrwx  1 rootroot  33 2009-05-05 07:21 django ->
> /home/malcolm/django-trunk/django
> drwxr-xr-x  4 malcolm malcolm 4096 2009-08-06 20:16 forms
> drwxr-xr-x  3 malcolm malcolm 4096 2009-05-27 08:27 http
> -rw-r--r--  1 malcolm malcolm  549 2009-08-06 20:16 __init__.py
> -rw-r--r--  1 malcolm malcolm  801 2009-08-06 20:16 __init__.pyc
> drwxr-xr-x  3 malcolm malcolm 4096 2009-08-14 05:13 middleware
> drwxr-xr-x  3 malcolm malcolm 4096 2009-04-30 05:43 shortcuts
> drwxr-xr-x  6 malcolm malcolm 4096 2009-08-06 20:16 .svn
> drwxr-xr-x  4 malcolm malcolm 4096 2009-08-06 20:16 template
> drwxr-xr-x  3 malcolm malcolm 4096 2009-08-06 20:16 templatetags
> drwxr-xr-x  3 malcolm malcolm 4096 2009-05-27 08:27 test
> drwxr-xr-x  5 malcolm malcolm 4096 2009-05-27 08:28 utils
> drwxr-xr-x  5 malcolm malcolm 4096 2009-08-06 20:17 views
> malc...@baglux:~/django-trunk/django$
>
>
> On Sun, Sep 27, 2009 at 1:24 AM, Vitaly Babiy <vbabi...@gmail.com> wrote:
>
>> Post the result of a ls -al in the django dir
>> Vitaly Babiy
>>
>>
>>
>> On Sat, Sep 26, 2009 at 7:16 PM, Malcolm MacKinnon 
>> <mmack3...@gmail.com>wrote:
>>
>>> About 8 moinths ago, I downloaded the development version of django and
>>> have been using it to develope a web site. I'm using Ubuntu, and I'm not a
>>> skilled programmer, and perhaps this was caused by something I did, but it
>>> appears I don't have subversion installed correctly, as the django directory
>>> inside the trunk keeps repeating itself. It keeps going on, perhaps creating
>>> new directory after new django directory forever. Here's an example:
>>>
>>>
>>> malc...@baglux://home/malcolm$ cd django-trunk
>>> malc...@baglux://home/malcolm/django-trunk$ ls
>>> AUTHORS  docs  extras   LICENSE  README   setup.cfg  tests
>>> django   examples  INSTALL  MANIFEST.in  scripts  setup.py
>>> malc...@baglux://home/malcolm/django-trunk$ cd django
>>> malc...@baglux://home/malcolm/django-trunk/django$ ls
>>> bin  core  django  __init__.py   shortcuts test
>>> conf dbforms   __init__.pyc  template  utils
>>> contrib  dispatch  httpmiddlewaretemplatetags  views
>>> malc...@baglux://home/malcolm/django-trunk/django$ cd django
>>> malc...@baglux://home/malcolm/django-trunk/django/django$ ls
>>> bin  core  django  __init__.py   shortcuts test
>>> conf dbforms   __init__.pyc  template  utils
>>> contrib  dispatch  httpmiddlewaretemplatetags  views
>>> malc...@baglux://home/malcolm/django-trunk/django/django$ cd django
>>> malc...@baglux://home/malcolm/django-trunk/django/django/django$ ls
>>> bin  core  django  __init__.py   shortcuts test
>>> conf dbforms   __init__.pyc  template  utils
>>> contrib  dispatch  httpmiddlewaretemplatetags  views
>>> malc...@baglux://home/malcolm/django-trunk/django/django/django$
>>> Etc., etc., etc...
>>>
>>> Any thoughts on what's causing this and how to correct it? Thanks!
>>>
>>>
>>>
>>
>>
>>
>
> >
>

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



Re: django-trunk/django directory problem

2009-09-26 Thread Vitaly Babiy
Post the result of a ls -al in the django dir
Vitaly Babiy


On Sat, Sep 26, 2009 at 7:16 PM, Malcolm MacKinnon <mmack3...@gmail.com>wrote:

> About 8 moinths ago, I downloaded the development version of django and
> have been using it to develope a web site. I'm using Ubuntu, and I'm not a
> skilled programmer, and perhaps this was caused by something I did, but it
> appears I don't have subversion installed correctly, as the django directory
> inside the trunk keeps repeating itself. It keeps going on, perhaps creating
> new directory after new django directory forever. Here's an example:
>
>
> malc...@baglux://home/malcolm$ cd django-trunk
> malc...@baglux://home/malcolm/django-trunk$ ls
> AUTHORS  docs  extras   LICENSE  README   setup.cfg  tests
> django   examples  INSTALL  MANIFEST.in  scripts  setup.py
> malc...@baglux://home/malcolm/django-trunk$ cd django
> malc...@baglux://home/malcolm/django-trunk/django$ ls
> bin  core  django  __init__.py   shortcuts test
> conf dbforms   __init__.pyc  template  utils
> contrib  dispatch  httpmiddlewaretemplatetags  views
> malc...@baglux://home/malcolm/django-trunk/django$ cd django
> malc...@baglux://home/malcolm/django-trunk/django/django$ ls
> bin  core  django  __init__.py   shortcuts test
> conf dbforms   __init__.pyc  template  utils
> contrib  dispatch  httpmiddlewaretemplatetags  views
> malc...@baglux://home/malcolm/django-trunk/django/django$ cd django
> malc...@baglux://home/malcolm/django-trunk/django/django/django$ ls
> bin  core  django  __init__.py   shortcuts test
> conf dbforms   __init__.pyc  template  utils
> contrib  dispatch  httpmiddlewaretemplatetags  views
> malc...@baglux://home/malcolm/django-trunk/django/django/django$
> Etc., etc., etc...
>
> Any thoughts on what's causing this and how to correct it? Thanks!
>
> >
>

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



Writers for a Django Blog

2009-09-19 Thread Vitaly Babiy
Hey guys,
I am looking for people would be interested in writing articles for a
django/web development blog, if you are interested please let me know.
Thanks,
Vitaly Babiy

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



Re: Django and SSL Deployment using mod_wsgi

2009-09-01 Thread Vitaly Babiy
Thanks guys for all the feedback, I have done what Francis said, we are
using nginx and apache/mod_wsgi in the back. Nginx handles the ssl and it
works great.
Thanks for the help.
Vitaly Babiy


On Tue, Sep 1, 2009 at 9:30 AM, Alex Robbins
<alexander.j.robb...@gmail.com>wrote:

>
> Graham,
>
> I'm interested in understanding what you just said. It seems like you
> are saying you can get the X-Forwarded-SSL environment variable to
> automatically be set, without needing the django middleware. Seems
> simple enough.
>
> The middleware also handles redirects, so that someone accidentally
> going to http://mysite/credit_card_form/ will be redirected to https://
> 
> I'm guessing that overriding the wsgi.url_scheme is meant to handle
> that, but I don't understand how.
>
> Thanks,
> Alex
>
> On Aug 31, 6:02 pm, Graham Dumpleton <graham.dumple...@gmail.com>
> wrote:
> > On Sep 1, 3:39 am, Francis <f.du...@gmail.com> wrote:
> >
> > > We setup a Nginx proxy in front of Apache/WSGI and got Nginx to handle
> > > the SSL cert and simply pass on a flag to WSGI if the connection was
> > > coming through http or https.
> >
> > > Next you'll want a SSL middleware, we use:
> http://www.djangosnippets.org/snippets/240/
> >
> > > Now its a matter of configuring which views you want SSL (follow
> > > example in the middleware)
> >
> > You don't need a SSL middleware. Just add to your Apache
> > configuration:
> >
> >   SetEnvIf X-Forwarded-SSL on HTTPS=1
> >
> > Apache/mod_wsgi will allow overriding of wsgi.url_scheme based on
> > HTTPS variable. The HTTPS variable can be set to 'On' or '1'. Case
> > ignored in comparison.
> >
> > Thus, you can use mod_setenvif to check for header being set and what
> > value and then set HTTPS.
> >
> > Graham
> >
> > > On Aug 28, 11:04 pm, Vitaly Babiy <vbabi...@gmail.com> wrote:
> >
> > > > Hey guys,
> > > > What is the best way to deploy an app that uses mod_wsgi that some
> parts of
> > > > it need to be behind SSL?
> >
> > > > Thanks,
> > > > Vitaly Babiy
> >
> >
> >
>

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



Django and SSL Deployment using mod_wsgi

2009-08-29 Thread Vitaly Babiy
Hey guys,
What is the best way to deploy an app that uses mod_wsgi that some parts of
it need to be behind SSL?

Thanks,
Vitaly Babiy

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



Re: Test server and Https

2009-08-22 Thread Vitaly Babiy
Alright, thanks
Vitaly Babiy


On Sat, Aug 22, 2009 at 12:31 PM, Andy McKay <a...@clearwind.ca> wrote:

>
>
> On 22-Aug-09, at 7:50 AM, Vitaly Babiy wrote:
>
> > Hey,
> > I am working on a site that part of it must be behind HTTPS, is
> > there any I can run this using the test server?
>
> The built in django server does not do HTTPS. Use Apache or some other
> server to serve HTTPS
> --
>   Andy McKay
>   Clearwind Consulting: www.clearwind.ca
>   Blog: www.agmweb.ca/blog/andy
>   Twitter: twitter.com/clearwind
>
>
> >
>

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



Test server and Https

2009-08-22 Thread Vitaly Babiy
Hey,I am working on a site that part of it must be behind HTTPS, is there
any I can run this using the test server?

Thanks,
Vitaly Babiy

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



Django Testing

2009-08-20 Thread Vitaly Babiy
I been working on a django project for some time and I keep running in to
the problem that fixtures are just to fragile, I was wondering if anyone had
a suggestion on how they work around this. Does anyone know of a factory
framework for django that I could define a collection of models and have the
models created before a test runs?

The idea comes from factorygirl(
http://www.thoughtbot.com/projects/factory_girl) in the ruby on rails world.

Thanks,
Vitaly Babiy

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



Remove unique from user model

2009-08-13 Thread Vitaly Babiy
Hello Guys,
So  I need to remove the unique flag off the username field in the user
model. I already extend the auth user model but I can't override the
username field. ( Django does not allow this )

What is the best way to do this?

Thanks
Vitaly Babiy

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



Timezones in Django

2009-08-10 Thread Vitaly Babiy
Hey guys, I am working on an application that needs to be timezone aware. Is
there support for this with in django I can't seem to find anything except
for a few third party packages. i am trying to find something that is in
django core.

Thanks,
Vitaly Babiy

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



Re: how to deploy Django on the web server?

2009-08-07 Thread Vitaly Babiy
Also you may want to look in to slice host. Awesome service.

Vitaly Babiy


On Fri, Aug 7, 2009 at 4:30 PM, Dan Harris <dih0...@gmail.com> wrote:

>
> I just wanted to give a shout out as well to webfaction. I used to use
> my own virtual private server for hosting django stuff, but to cut
> costs i switched to a webfaction account and it is pretty fantastic.
> Super easy to set up, if you decide to go that way just drop me and
> email and i'd be happy to help you get set up and running.
>
> Cheers,
>
> Dan
>
> On Aug 7, 3:34 pm, lzantal <lzan...@gmail.com> wrote:
> > On Aug 7, 12:06 pm, justin jools <justinjo...@googlemail.com> wrote:>
> This has been driving me nuts for a month.
> >
> > > I wanted to use a free web server to do development testing and have
> > > found : 000webhost.com and heliohost.com which apparently support
> > > Python, but what about Django? Do I install that myself?
> >
> > > I have read the django book on deployment chapter but find it doesnt
> > > tell me what I want.
> >
> > > Could someone please just tell me simply how I can get my scripts
> > > running on the webserver.
> >
> > Tryhttp://webfaction.com.
> > They have super easy install for django through their control panel
> >
> > hope that helps
> >
> > lzantalhttp://twitter.com/lzantal
> >
> >
> >
> > > justinjo...@googlemail.com
> >
>

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



Re: Url Namespaces

2009-07-27 Thread Vitaly Babiy
Thanks, I knew it had to be somewhere in the docs.
Vitaly Babiy


On Sun, Jul 26, 2009 at 7:16 PM, Vasil Vangelovski
<vvangelov...@gmail.com>wrote:

>
> See this:
>
>
> http://docs.djangoproject.com/en/dev/topics/http/urls/#defining-url-namespaces
>
> On Mon, Jul 27, 2009 at 12:13 AM, Vitaly Babiy<vbabi...@gmail.com> wrote:
> > How does one go about registering a namespace?
> > I can't seem to find it in the docs.
> > Thanks,
> > Vitaly Babiy
> >
> > >
> >
>
> >
>

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



Re: Auth test with custom auth backend

2009-07-27 Thread Vitaly Babiy
Yeah, I have thought about removing auth from my installed app but the
problem is I am going to be using the permissions part of the app.
Have the auth app support a custom model would be cool.

Also it might not be to bad to write a custom test runner that will ignore
test from apps listed in a setting config

Thank,
Vitaly Babiy


On Sun, Jul 26, 2009 at 9:06 PM, Russell Keith-Magee <freakboy3...@gmail.com
> wrote:

>
> On Mon, Jul 27, 2009 at 6:17 AM, Vitaly Babiy<vbabi...@gmail.com> wrote:
> > Hey,
> > I have replaced the default auth backend with my own that requires a
> field
> > to be set on my own custom user objects. So when I run my test suite (
> which
> > includes the auth app ) most of the auth test fail. Due to the fact that
> > djangos fixtures don't create user object of my custom type. What is the
> > best way to work around this?
>
> There isn't really an easy workaround. If you put contrib.auth in your
> INSTALLED_APPS, Django assumes - somewhat reasonably - that you are
> using the User model.
>
> One approach that may be worth considering is to look at whether you
> actually need to put contrib.auth in INSTALLED APPS. If you're just
> using some of the backend utilities - such as the authentication
> backends - you may not need to sync the auth application itself.
>
> Beyond that, you're into slightly unexplored territory. The hardcore
> approach would be to just delete the tests directory from
> contrib.auth. This will make the test failure go away, but that's a
> bit like saying you can fix your long toenails by amputating your foot
> :-) There may be a less hardcore solution, but it will require some
> exploration on your part. It certainly isn't part of an official API
> at this point.
>
> This issue actually covers two problems that I'd like to address in
> the Django v1.2 timeframe. Firstly, differentiating between
> integration tests and release tests; secondly, making the User model
> truly pluggable, especially with respect to contrib.admin. Any
> feedback or input you have would be most welcome.
>
> Yours,
> Russ Magee %-)
>
> >
>

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



Auth test with custom auth backend

2009-07-26 Thread Vitaly Babiy
Hey,
I have replaced the default auth backend with my own that requires a field
to be set on my own custom user objects. So when I run my test suite ( which
includes the auth app ) most of the auth test fail. Due to the fact that
djangos fixtures don't create user object of my custom type. What is the
best way to work around this?

Thanks,
Vitaly Babiy

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



Url Namespaces

2009-07-26 Thread Vitaly Babiy
How does one go about registering a namespace?
I can't seem to find it in the docs.

Thanks,
Vitaly Babiy

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



Re: ModelForm and Form is_bound issue

2009-07-16 Thread Vitaly Babiy
Sorry this was my fault, didn't test my test case. It was a bug in my test
code.
Thanks any way
Vitaly Babiy


On Thu, Jul 16, 2009 at 1:23 PM, Karen Tracey <kmtra...@gmail.com> wrote:

> On Thu, Jul 16, 2009 at 8:53 AM, Vitaly Babiy <vbabi...@gmail.com> wrote:
>
>> Hello everyone,
>> [snip]
>> Now lets try it with a ModelForm
>>
>> class UserForm(forms.ModelForm):
>> class Meta:
>> model=User
>> fields= ('first_name',)
>>
>> >>> form = UserForm()
>> >>> form.is_bound
>> False # this is good
>> >>> form = UserForm({})
>> >>> form.is_bound
>> False # this should be true
>>
>> I am not sure why when you give a model form data it does not become
>> bound.
>>
>> Is this a bug?
>>
>
> I can't recreate this with either current trunk or 1.0.2:
>
> >>> import django
> >>> django.get_version()
> '1.0.2 final'
> >>> from django import forms
> >>> from django.contrib.auth.models import User
> >>> class UserForm(forms.ModelForm):
> ... class Meta:
> ... model = User
> ... fields = ('first_name',)
>  ...
> >>> uf1 = UserForm()
> >>> uf1.is_bound
> False
> >>> uf2 = UserForm({})
> >>> uf2.is_bound
> True
> >>>
>
> What version of Django are you using?
>
> Karen
>
> >
>

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



Re: How to save Unicode data to mysql database?

2009-07-16 Thread Vitaly Babiy
Make your your database tables are using utf-8. Here is a great post about
the topic
http://blog.awarelabs.com/2008/django-tips-utf-8-ascii-encoding-errors-urllib2-and-mysql/
Vitaly Babiy


On Thu, Jul 16, 2009 at 1:03 PM, Qixing DU <qixing...@gmail.com> wrote:

>
> Dear All,
>
> I need to handle non-latin code. But encountered an error looking
> like:
>
> "Data too long for column 'user_name' at row 1"
>
> The username is: user_name = u'frank'
>
> The database is mysql 5.0. I didn't find anything useful via google.
>
> Is this a known issue in Django? How to fix it? Thank you so much!
>
> Best Regards,
> Frank
>
>
> >
>

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



ModelForm and Form is_bound issue

2009-07-16 Thread Vitaly Babiy
Hello everyone,
If you take a form like this:

class EmailForm(forms.Form):
email = froms.EmailField()

>>> form = EmailForm()
>>> form.is_bound
False
>>> form = EmailForm({})
>>> form.is_bound
True

That works great
Now lets try it with a ModelForm

class UserForm(forms.ModelForm):
class Meta:
model=User
fields= ('first_name',)

>>> form = UserForm()
>>> form.is_bound
False # this is good
>>> form = UserForm({})
>>> form.is_bound
False # this should be true

I am not sure why when you give a model form data it does not become bound.

Is this a bug?

Vitaly Babiy

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



Re: Best distro for django

2009-07-03 Thread Vitaly Babiy
I use Ubuntu 9.04, works great on a XPS M1530 Laptop

Vitaly Babiy


On Fri, Jul 3, 2009 at 2:36 PM, developingchris
<developingch...@gmail.com>wrote:

>
> Looking for opinion of the best distro for a developer machine for
> django.
>
> I'm on ubuntu now, its going ok. I'm having keyboard issues, and
> wondering if I should put the time in on fixing it, or just ditch it
> for say, pc-bsd, if thats what the cool django kids are using.
>
> >
>

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



Re: Mysql and utf8

2009-06-18 Thread Vitaly Babiy
Thanks Ramiro

Vitaly Babiy


On Thu, Jun 18, 2009 at 3:08 PM, Ramiro Morales <cra...@gmail.com> wrote:

>
> On Thu, Jun 18, 2009 at 4:01 PM, Vitaly Babiy<vbabi...@gmail.com> wrote:
> > Is there a way to tell django with a setting to include the character-set
> on
> > the create of tables?
>
> This (the whole thread topic) is one of the many topics covered by
> the profuse MySQL-specific notes that are part of the Django
> documentation:
>
> http://docs.djangoproject.com/en/dev/ref/databases/#creating-your-tables
>
>
> --
> Ramiro Morales
> http://rmorales.net
>
> >
>

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



Re: Mysql and utf8

2009-06-18 Thread Vitaly Babiy
Is there a way to tell django with a setting to include the character-set on
the create of tables?

Vitaly Babiy


On Thu, Jun 18, 2009 at 2:18 PM, Karen Tracey <kmtra...@gmail.com> wrote:

> On Thu, Jun 18, 2009 at 2:06 PM, Vitaly Babiy <vbabi...@gmail.com> wrote:
>
>> I am using MySQL.
>>
>> Sorry I should have mentioned it in the body not only in the subject.
>>
>
> Yeah, sorry I tend to be blind to subjects.  You can configure your server
> to use utf8 by default by including:
>
> default-character-set=utf8
>
> somewhere in the [mysqld] section of the config file.  The config file is
> my.ini in the MySQL install directory on Windows, or something like
> /etc/mysql/my.cnf probably on Linux.
>
> If you want to change tables that have already been created, the command
> is:
>
> alter table  convert to character set utf8;
>
> from within a mysql shell.
>
> Karen
>
>
> >
>

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



Re: Mysql and utf8

2009-06-18 Thread Vitaly Babiy
I am using MySQL.

Sorry I should have mentioned it in the body not only in the subject.

Thanks
Vitaly Babiy


On Thu, Jun 18, 2009 at 1:46 PM, Karen Tracey <kmtra...@gmail.com> wrote:

> On Thu, Jun 18, 2009 at 1:44 PM, Vitaly Babiy <vbabi...@gmail.com> wrote:
>
>> Hey All,
>> How can I have django create the tables that are utf8 encoding.
>>
>
> What database are you using?  Without knowing that it's going to be rather
> hard to help you.
>
> Karen
>
> >
>

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



Mysql and utf8

2009-06-18 Thread Vitaly Babiy
Hey All,
How can I have django create the tables that are utf8 encoding.

Thanks,
Vitaly Babiy

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



Re: Change AuthenticationForm error message

2009-06-15 Thread Vitaly Babiy
Yeah I think that is what I am going to do.

Thanks
Vitaly Babiy


On Mon, Jun 15, 2009 at 4:58 PM, TiNo <tin...@gmail.com> wrote:

> On Sun, Jun 14, 2009 at 14:45, Vitaly Babiy <vbabi...@gmail.com> wrote:
>
>> Hey Everyone,
>> I need to change the inactive account error message on the
>> AuthenticationForm, one thing I have is to replace the clean method on the
>> form with my own custom clean method the problem with this is django test
>> fail when I do this. I was wondering was is the best practice when it comes
>> to this.
>>
>
> You could subclass AuthenticationForm, override the clean method, and use
> it in your own custom login view. That is probably the easiest.
>
> TiNo
>
> >
>

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



Re: Change AuthenticationForm error message

2009-06-15 Thread Vitaly Babiy
That seem likes to much overhead to make every request to go through.

Vitaly Babiy


On Mon, Jun 15, 2009 at 1:31 AM, Rama Vadakattu <rama.vadaka...@gmail.com>wrote:

>
> one simple idea ( it may or may not be feasible ) that you can use is
> 1) write down a middleware
> 2) examine the context which has a form and with the above error
> message
>and replace it with your new error message
>
>
>
> On Jun 14, 5:45 pm, Vitaly Babiy <vbabi...@gmail.com> wrote:
> > Hey Everyone,
> > I need to change the inactive account error message on the
> > AuthenticationForm, one thing I have is to replace the clean method on
> the
> > form with my own custom clean method the problem with this is django test
> > fail when I do this. I was wondering was is the best practice when it
> comes
> > to this.
> >
> > Thanks,
> > Vitaly Babiy
> >
>

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



Change AuthenticationForm error message

2009-06-14 Thread Vitaly Babiy
Hey Everyone,
I need to change the inactive account error message on the
AuthenticationForm, one thing I have is to replace the clean method on the
form with my own custom clean method the problem with this is django test
fail when I do this. I was wondering was is the best practice when it comes
to this.

Thanks,
Vitaly Babiy

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



Re: Max_num in formset

2009-03-29 Thread Vitaly Babiy
Maybe I should have said why I ask.

I have a formset that the formset can not submit more than certain number of
forms. I was not sure if max_num handles this or do I need to do this with
some custom validation?

Vitaly Babiy


On Sun, Mar 29, 2009 at 5:57 PM, Vitaly Babiy <vbabi...@gmail.com> wrote:

> If the count of forms submit goes over the max_num shouldn't it raise and
> validation error?
>
> Thanks,
> Vitaly Babiy
>

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



Max_num in formset

2009-03-29 Thread Vitaly Babiy
If the count of forms submit goes over the max_num shouldn't it raise and
validation error?

Thanks,
Vitaly Babiy

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



Re: Django an STI

2009-03-07 Thread Vitaly Babiy
Thanks Malcolm for the response,
I am only really instressed in the last part:

The "complex" thing that we might do, one day, is providing a way to
also retrieve all the descendents from a base table. It won't be
particularly efficient, but that's because SQL is relational and not
object-oriented.

But like you said before I can do this with itertool.chain, for now.

Vitaly Babiy


On Sat, Mar 7, 2009 at 8:03 PM, Malcolm Tredinnick <malc...@pointy-stick.com
> wrote:

>
> On Sat, 2009-03-07 at 06:50 -0600, Tim Chase wrote:
> [...]
> > A slightly less DRY solution than ideal (ideal=solving the VERY
> > complex STI problem in Django's ORM),
>
> Um .. no. That's the one thing that is almost certainly not going to
> happen. Single-table inheritance --- a.k.a shoving all your columns for
> all your models into a single table -- is a really bad design pattern
> (you lose the ability to do all sorts of things, like enforcing not-NUL
> constraints). Not to mention being completely impractical when it comes
> to subclassing third-party models.
>
> If you want to do this, there's a much better way: you create one table
> (either manually or by creating a mega-model and running syncdb). Then
> you create your submodels which only specify the columns they are
> interested in. After all, a Django model doesn't have to specify or
> utilise every single column in a database table.
>
> So if you want to use this pattern, treat it honestly: it's a single
> table where you're only accessing a subset of columns. Django can
> already support that.
>
> The "complex" thing that we might do, one day, is providing a way to
> also retrieve all the descendents from a base table. It won't be
> particularly efficient, but that's because SQL is relational and not
> object-oriented.
>
> Regards,
> Malcolm
>
>
>
> >
>

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



Re: Django an STI

2009-03-07 Thread Vitaly Babiy
How would generic relations solve this problem, It has been recommend for me
to look at it a few times but I can't seem to understand how it would work.

Vitaly Babiy


On Sat, Mar 7, 2009 at 7:50 AM, Tim Chase <django.us...@tim.thechases.com>wrote:

>
> >> class Tracker(models.Model):
> >>notifications = models.ForeignKey(Notification)
> >>
> >> class Notification(models.Model):
> >> # Common fields
> >> pass
> >>
> >> class EmailNotification(Notification):
> >>pass
> >>
> >> class SmsNotification(Notification):
> >>pass
> >>
> >>
> >> # I would be able to iterate over all types of notification
> >> for n in tracker.notifications:
> >>print n
> >
> > Not trivially, purely in SQL, at the moment. You really need to union
> > two sets of results together, since they're querying different tables.
> > Lots of history here, but basically, it's a hard problem to solve
> > efficiently. One day we might do it.
>
> If one is willing to be roped to PostgreSQL, it does support such
> a scheme with table-inheritance.  You'd have to hack the table
> definitions by hand instead of letting "manage.py syncdb" do it
> for you.  Additionally, Django's ORM knows nothing about this DB
> hack, so virtual methods won't work like one might hope:
>
>   class Notification(models.Model):
> def __unicode__(self):
>   return u"Generic notification:" % self.common_field
>   class EmailNotification(Notification):
> def __unicode__(self):
>   return u"Email: %s" % self.some_email_field
>   class SMSNotification(Notification):
> def __unicode__(self):
>   return u"SMS: %s" % self.some_sms_field
>
>   for n in tracker.notifications:
>  print unicode(s)
>
> You'll end up with every item being treated as a Notification
> object (and thus printing "Generic notification" for all of
> them), rather than getting the notification-specific methods.
>
> > On the other hand, since querysets are iterators, you can construct two
> > querysets and then use itertools.chain to combine them and have it
> > appears as a single iterator.
>
> A slightly less DRY solution than ideal (ideal=solving the VERY
> complex STI problem in Django's ORM), but more portable across
> database back-ends, less fragile, and available out of the box.
>
> Another alternative might be using Django's built-in generic
> relations.
>
> -tim
>
>
>
>
>
> >
>

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



Re: Python Multiprocessing With Django

2009-03-06 Thread Vitaly Babiy
Thanks Jirka, that fixed the problem. But I think I will file a bug report
that seem to be very hacky :)

Vitaly Babiy


On Fri, Mar 6, 2009 at 11:15 AM, Vitaly Babiy <vbabi...@gmail.com> wrote:

> Alright I will have to give this a try
>
> Vitaly Babiy
>
>
>
> On Fri, Mar 6, 2009 at 10:30 AM, Jirka Vejrazka 
> <jirka.vejra...@gmail.com>wrote:
>
>>
>> > I have a management command that that starts up a few process to process
>> a
>> > request: http://dpaste.com/7925/.
>>
>> Hi, I was recently debugging similar issue and came to a conclusion
>> (which may be wrong of course :)  that multiprocessing and Django DB
>> connections don't play well together. I ended up closing Django DB
>> connection first thing in the new process. It'll recreate a new
>> connection when it needs one, but that one will have no references to
>> the connection used by the parent.
>>
>> So, my Process.start() calls a function which starts with:
>> >>> from django.db import connection
>> >>> connection.close()
>>
>>  This solved my problem.
>>
>>   Cheers
>>
>> Jirka
>>
>> >>
>>
>

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



Re: Python Multiprocessing With Django

2009-03-06 Thread Vitaly Babiy
Alright I will have to give this a try

Vitaly Babiy


On Fri, Mar 6, 2009 at 10:30 AM, Jirka Vejrazka <jirka.vejra...@gmail.com>wrote:

>
> > I have a management command that that starts up a few process to process
> a
> > request: http://dpaste.com/7925/.
>
> Hi, I was recently debugging similar issue and came to a conclusion
> (which may be wrong of course :)  that multiprocessing and Django DB
> connections don't play well together. I ended up closing Django DB
> connection first thing in the new process. It'll recreate a new
> connection when it needs one, but that one will have no references to
> the connection used by the parent.
>
> So, my Process.start() calls a function which starts with:
> >>> from django.db import connection
> >>> connection.close()
>
>  This solved my problem.
>
>   Cheers
>
> Jirka
>
> >
>

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



Python Multiprocessing With Django

2009-03-06 Thread Vitaly Babiy
I have a management command that that starts up a few process to process a
request: http://dpaste.com/7925/.

But every so offen I get a exception say mysql went a way, but it didn't.
Process PoolWorker-3:
Traceback (most recent call last):
 File 
"/usr/lib/python2.5/site-packages/multiprocessing-2.6.1.1-py2.5-linux-i686.egg/multiprocessing/process.py",
line 236, in _bootstrap
   self.run()
 File
"/usr/lib/python2.5/site-packages/multiprocessing-2.6.1.1-py2.5-linux-i686.egg/multiprocessing/process.py",
line 93, in run
   self._target(*self._args, **self._kwargs)
 File
"/usr/lib/python2.5/site-packages/multiprocessing-2.6.1.1-py2.5-linux-i686.egg/multiprocessing/pool.py",
line 71, in worker
   put((job, i, result))
 File
"/usr/lib/python2.5/site-packages/multiprocessing-2.6.1.1-py2.5-linux-i686.egg/multiprocessing/queues.py",
line 353, in put
   return send(obj)
PicklingError: Can't pickle :
attribute lookup http_tracker.models.DoesNotExist failed
Traceback (most recent call last):
 File "/home/vbabiy/projects/git-projects/howsthedotcom/manage.py", line 11,
in 
   execute_manager(settings)
 File "/usr/lib/python2.5/site-packages/django/core/management/__init__.py",
line 350, in execute_manager
   utility.execute()
 File "/usr/lib/python2.5/site-packages/django/core/management/__init__.py",
line 295, in execute
   self.fetch_command(subcommand).run_from_argv(self.argv)
 File "/usr/lib/python2.5/site-packages/django/core/management/base.py",
line 195, in run_from_argv
   self.execute(*args, **options.__dict__)
 File "/usr/lib/python2.5/site-packages/django/core/management/base.py",
line 222, in execute
   output = self.handle(*args, **options)
 File
"/home/vbabiy/projects/git-projects/howsthedotcom/tracker/management/commands/tracker.py",
line 37, in handle
   res = p.map(check_site, sites)
 File
"/usr/lib/python2.5/site-packages/multiprocessing-2.6.1.1-py2.5-linux-i686.egg/multiprocessing/pool.py",
line 148, in map
   return self.map_async(func, iterable, chunksize).get()
 File
"/usr/lib/python2.5/site-packages/multiprocessing-2.6.1.1-py2.5-linux-i686.egg/multiprocessing/pool.py",
line 422, in get
   raise self._value
_mysql_exceptions.OperationalError: (2013, 'Lost connection to MySQL server
during query')

Any one got any idea why this is happening?

Vitaly Babiy

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



Re: Fixtures with custom constructor

2009-02-28 Thread Vitaly Babiy
Here is my constructor:

class EmailVerification(models.Model):
def __init__(self, user, ip, *args, **kargs):
# Build sha1 for email verification
sha1 = sha.new("".join([str(user.id), user.email, ip]))
self.sha = sha1
self.user = user


Vitaly Babiy


On Sat, Feb 28, 2009 at 3:41 PM, Alex Gaynor <alex.gay...@gmail.com> wrote:

>
>
> On Sat, Feb 28, 2009 at 3:38 PM, Vitaly Babiy <vbabi...@gmail.com> wrote:
>
>> I have a model that I have created a custom consturctor now when I use it
>> in a test or in loaddata, I get this error:
>>
>> vba...@vbabiy-laptop:~/projects/git-projects/howsthedotcom$ ./manage.py
>> loaddata email_verification
>> Installing json fixture 'email_verification' from
>> '/home/vbabiy/projects/git-projects/howsthedotcom/../howsthedotcom/fixtures'.
>> Problem installing fixture
>> '/home/vbabiy/projects/git-projects/howsthedotcom/../howsthedotcom/fixtures/email_verification.json':
>> Traceback (most recent call last):
>>   File
>> "/usr/lib/python2.5/site-packages/django/core/management/commands/loaddata.py",
>> line 150, in handle
>> for obj in objects:
>>   File "/usr/lib/python2.5/site-packages/django/core/serializers/json.py",
>> line 41, in Deserializer
>> for obj in PythonDeserializer(simplejson.load(stream)):
>>   File
>> "/usr/lib/python2.5/site-packages/django/core/serializers/python.py", line
>> 96, in Deserializer
>> yield base.DeserializedObject(Model(**data), m2m_data)
>> TypeError: __init__() takes at least 3 non-keyword arguments (1 given)
>>
>>
>>
>>
>> Vitaly Babiy
>>
>>
>>
> You need to create a constructor that has a comptible signature with the
> default one, Django instantiates models in a number of places and short of
> going in and hacking up the django source(which will cause it to break for
> other models) it's not going to magically work with your new signature.  If
> you could provide your modified __init__ we could give some suggestions as
> to how to make the signature compatible.
>
> 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
-~--~~~~--~~--~--~---



Fixtures with custom constructor

2009-02-28 Thread Vitaly Babiy
I have a model that I have created a custom consturctor now when I use it in
a test or in loaddata, I get this error:

vba...@vbabiy-laptop:~/projects/git-projects/howsthedotcom$ ./manage.py
loaddata email_verification
Installing json fixture 'email_verification' from
'/home/vbabiy/projects/git-projects/howsthedotcom/../howsthedotcom/fixtures'.
Problem installing fixture
'/home/vbabiy/projects/git-projects/howsthedotcom/../howsthedotcom/fixtures/email_verification.json':
Traceback (most recent call last):
  File
"/usr/lib/python2.5/site-packages/django/core/management/commands/loaddata.py",
line 150, in handle
for obj in objects:
  File "/usr/lib/python2.5/site-packages/django/core/serializers/json.py",
line 41, in Deserializer
for obj in PythonDeserializer(simplejson.load(stream)):
  File "/usr/lib/python2.5/site-packages/django/core/serializers/python.py",
line 96, in Deserializer
yield base.DeserializedObject(Model(**data), m2m_data)
TypeError: __init__() takes at least 3 non-keyword arguments (1 given)




Vitaly Babiy

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



Re: Testing Django and HTTP Request

2009-02-09 Thread Vitaly Babiy
Hey Alex I got cherrypy to work great I am going to post a blog as soon as
my blog is done :)
If anyone cares just ask here and I will post a write up here.

Vitaly Babiy


On Mon, Feb 9, 2009 at 7:52 AM, Vitaly Babiy <vbabi...@gmail.com> wrote:

> Thank you Alex for you help I will look in to this.
>
> Vitaly Babiy
>
>
>
> On Mon, Feb 9, 2009 at 12:32 AM, Alex Gaynor <alex.gay...@gmail.com>wrote:
>
>>
>>
>> On Mon, Feb 9, 2009 at 12:28 AM, Vitaly Babiy <vbabi...@gmail.com> wrote:
>>
>>> Yeah, it does. I am going to have to look to see if can find a better
>>> stand alone server to do this instead of patching django.
>>>
>>> Vitaly Babiy
>>>
>>>
>>> On Mon, Feb 9, 2009 at 12:22 AM, Alex Gaynor <alex.gay...@gmail.com>wrote:
>>>
>>>>
>>>>
>>>> On Mon, Feb 9, 2009 at 12:18 AM, Vitaly Babiy <vbabi...@gmail.com>wrote:
>>>>
>>>>> Yea, but I see a few problems whit that solution:
>>>>>
>>>>>- Hacky
>>>>>- Still not guaranteed to work( it could take more time)
>>>>>- Would really slow down the tests
>>>>>
>>>>> Vitaly Babiy
>>>>>
>>>>>
>>>>> On Mon, Feb 9, 2009 at 12:15 AM, Alex Gaynor <alex.gay...@gmail.com>wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>> On Mon, Feb 9, 2009 at 12:13 AM, Vitaly Babiy <vbabi...@gmail.com>wrote:
>>>>>>
>>>>>>> Right the problem is if I reload the server on ever test, there is
>>>>>>> not enough time for the thread to kill the server. So when the next 
>>>>>>> setUp
>>>>>>> comes around the port is still in use.
>>>>>>> I think I need to find a way to start a HTTP server at the beginning
>>>>>>> of the test and keep it around till all test are done. And have a way to
>>>>>>> tell the server what to return on the request.
>>>>>>>
>>>>>>> Vitaly Babiy
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Feb 9, 2009 at 12:08 AM, Alex Gaynor 
>>>>>>> <alex.gay...@gmail.com>wrote:
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Feb 9, 2009 at 12:06 AM, Vitaly Babiy 
>>>>>>>> <vbabi...@gmail.com>wrote:
>>>>>>>>
>>>>>>>>> Hello everyone,
>>>>>>>>>
>>>>>>>>> I am working on a project that will need to make a request out to
>>>>>>>>> the web and pull down some data, For testing purpose I was wonder 
>>>>>>>>> what would
>>>>>>>>> be the best way to test this. I don't want to make the actual request 
>>>>>>>>> during
>>>>>>>>> the test, because for one if I am off-line all those tests will fail.
>>>>>>>>>
>>>>>>>>> I have tried to implement a HTTPServer in python. The problem I am
>>>>>>>>> having is once I have it thread, If I put it in the setUp method  and
>>>>>>>>> tearDown I get port in use exception. Due to the nature of the thread 
>>>>>>>>> it is
>>>>>>>>> not guaranteed to be killed in time.
>>>>>>>>>
>>>>>>>>> Vitaly Babiy
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> You should be able to save the thread on the Test object during
>>>>>>>> setup() and then kill it on teardown() shouldn't you?
>>>>>>>>
>>>>>>>> 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
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> What if you just put a time.sleep(2) at the end of tearDown() that
>>>>>> should give the thread enough time to close before the next test starts.
>>>>>>
>>>>>>
>>>>>> 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
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>> Is what you are ultimately searching for similar to this:
>>>> http://code.djangoproject.com/ticket/2879
>>>>
>>>>
>>>> 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
>>>>
>>>>
>>>>
>>>
>>>
>>>
>> The CherryPy WSGI server is usually a good choice for these things.
>>
>>
>> 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
-~--~~~~--~~--~--~---



Re: Testing Django and HTTP Request

2009-02-09 Thread Vitaly Babiy
Thank you Alex for you help I will look in to this.

Vitaly Babiy


On Mon, Feb 9, 2009 at 12:32 AM, Alex Gaynor <alex.gay...@gmail.com> wrote:

>
>
> On Mon, Feb 9, 2009 at 12:28 AM, Vitaly Babiy <vbabi...@gmail.com> wrote:
>
>> Yeah, it does. I am going to have to look to see if can find a better
>> stand alone server to do this instead of patching django.
>>
>> Vitaly Babiy
>>
>>
>> On Mon, Feb 9, 2009 at 12:22 AM, Alex Gaynor <alex.gay...@gmail.com>wrote:
>>
>>>
>>>
>>> On Mon, Feb 9, 2009 at 12:18 AM, Vitaly Babiy <vbabi...@gmail.com>wrote:
>>>
>>>> Yea, but I see a few problems whit that solution:
>>>>
>>>>- Hacky
>>>>- Still not guaranteed to work( it could take more time)
>>>>- Would really slow down the tests
>>>>
>>>> Vitaly Babiy
>>>>
>>>>
>>>> On Mon, Feb 9, 2009 at 12:15 AM, Alex Gaynor <alex.gay...@gmail.com>wrote:
>>>>
>>>>>
>>>>>
>>>>> On Mon, Feb 9, 2009 at 12:13 AM, Vitaly Babiy <vbabi...@gmail.com>wrote:
>>>>>
>>>>>> Right the problem is if I reload the server on ever test, there is not
>>>>>> enough time for the thread to kill the server. So when the next setUp 
>>>>>> comes
>>>>>> around the port is still in use.
>>>>>> I think I need to find a way to start a HTTP server at the beginning
>>>>>> of the test and keep it around till all test are done. And have a way to
>>>>>> tell the server what to return on the request.
>>>>>>
>>>>>> Vitaly Babiy
>>>>>>
>>>>>>
>>>>>> On Mon, Feb 9, 2009 at 12:08 AM, Alex Gaynor 
>>>>>> <alex.gay...@gmail.com>wrote:
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Feb 9, 2009 at 12:06 AM, Vitaly Babiy <vbabi...@gmail.com>wrote:
>>>>>>>
>>>>>>>> Hello everyone,
>>>>>>>>
>>>>>>>> I am working on a project that will need to make a request out to
>>>>>>>> the web and pull down some data, For testing purpose I was wonder what 
>>>>>>>> would
>>>>>>>> be the best way to test this. I don't want to make the actual request 
>>>>>>>> during
>>>>>>>> the test, because for one if I am off-line all those tests will fail.
>>>>>>>>
>>>>>>>> I have tried to implement a HTTPServer in python. The problem I am
>>>>>>>> having is once I have it thread, If I put it in the setUp method  and
>>>>>>>> tearDown I get port in use exception. Due to the nature of the thread 
>>>>>>>> it is
>>>>>>>> not guaranteed to be killed in time.
>>>>>>>>
>>>>>>>> Vitaly Babiy
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> You should be able to save the thread on the Test object during
>>>>>>> setup() and then kill it on teardown() shouldn't you?
>>>>>>>
>>>>>>> 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
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> What if you just put a time.sleep(2) at the end of tearDown() that
>>>>> should give the thread enough time to close before the next test starts.
>>>>>
>>>>>
>>>>> 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
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>> Is what you are ultimately searching for similar to this:
>>> http://code.djangoproject.com/ticket/2879
>>>
>>>
>>> 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
>>>
>>>
>>>
>>
>>
>>
> The CherryPy WSGI server is usually a good choice for these things.
>
>
> 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
-~--~~~~--~~--~--~---



Re: Testing Django and HTTP Request

2009-02-08 Thread Vitaly Babiy
Yeah, it does. I am going to have to look to see if can find a better stand
alone server to do this instead of patching django.

Vitaly Babiy


On Mon, Feb 9, 2009 at 12:22 AM, Alex Gaynor <alex.gay...@gmail.com> wrote:

>
>
> On Mon, Feb 9, 2009 at 12:18 AM, Vitaly Babiy <vbabi...@gmail.com> wrote:
>
>> Yea, but I see a few problems whit that solution:
>>
>>- Hacky
>>- Still not guaranteed to work( it could take more time)
>>    - Would really slow down the tests
>>
>> Vitaly Babiy
>>
>>
>> On Mon, Feb 9, 2009 at 12:15 AM, Alex Gaynor <alex.gay...@gmail.com>wrote:
>>
>>>
>>>
>>> On Mon, Feb 9, 2009 at 12:13 AM, Vitaly Babiy <vbabi...@gmail.com>wrote:
>>>
>>>> Right the problem is if I reload the server on ever test, there is not
>>>> enough time for the thread to kill the server. So when the next setUp comes
>>>> around the port is still in use.
>>>> I think I need to find a way to start a HTTP server at the beginning of
>>>> the test and keep it around till all test are done. And have a way to tell
>>>> the server what to return on the request.
>>>>
>>>> Vitaly Babiy
>>>>
>>>>
>>>> On Mon, Feb 9, 2009 at 12:08 AM, Alex Gaynor <alex.gay...@gmail.com>wrote:
>>>>
>>>>>
>>>>>
>>>>> On Mon, Feb 9, 2009 at 12:06 AM, Vitaly Babiy <vbabi...@gmail.com>wrote:
>>>>>
>>>>>> Hello everyone,
>>>>>>
>>>>>> I am working on a project that will need to make a request out to the
>>>>>> web and pull down some data, For testing purpose I was wonder what would 
>>>>>> be
>>>>>> the best way to test this. I don't want to make the actual request during
>>>>>> the test, because for one if I am off-line all those tests will fail.
>>>>>>
>>>>>> I have tried to implement a HTTPServer in python. The problem I am
>>>>>> having is once I have it thread, If I put it in the setUp method  and
>>>>>> tearDown I get port in use exception. Due to the nature of the thread it 
>>>>>> is
>>>>>> not guaranteed to be killed in time.
>>>>>>
>>>>>> Vitaly Babiy
>>>>>>
>>>>>>
>>>>>>
>>>>> You should be able to save the thread on the Test object during setup()
>>>>> and then kill it on teardown() shouldn't you?
>>>>>
>>>>> 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
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>> What if you just put a time.sleep(2) at the end of tearDown() that should
>>> give the thread enough time to close before the next test starts.
>>>
>>>
>>> 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
>>>
>>>
>>>
>>
>>
>>
> Is what you are ultimately searching for similar to this:
> http://code.djangoproject.com/ticket/2879
>
>
> 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
-~--~~~~--~~--~--~---



Re: Testing Django and HTTP Request

2009-02-08 Thread Vitaly Babiy
Yea, but I see a few problems whit that solution:

   - Hacky
   - Still not guaranteed to work( it could take more time)
   - Would really slow down the tests

Vitaly Babiy


On Mon, Feb 9, 2009 at 12:15 AM, Alex Gaynor <alex.gay...@gmail.com> wrote:

>
>
> On Mon, Feb 9, 2009 at 12:13 AM, Vitaly Babiy <vbabi...@gmail.com> wrote:
>
>> Right the problem is if I reload the server on ever test, there is not
>> enough time for the thread to kill the server. So when the next setUp comes
>> around the port is still in use.
>> I think I need to find a way to start a HTTP server at the beginning of
>> the test and keep it around till all test are done. And have a way to tell
>> the server what to return on the request.
>>
>> Vitaly Babiy
>>
>>
>> On Mon, Feb 9, 2009 at 12:08 AM, Alex Gaynor <alex.gay...@gmail.com>wrote:
>>
>>>
>>>
>>> On Mon, Feb 9, 2009 at 12:06 AM, Vitaly Babiy <vbabi...@gmail.com>wrote:
>>>
>>>> Hello everyone,
>>>>
>>>> I am working on a project that will need to make a request out to the
>>>> web and pull down some data, For testing purpose I was wonder what would be
>>>> the best way to test this. I don't want to make the actual request during
>>>> the test, because for one if I am off-line all those tests will fail.
>>>>
>>>> I have tried to implement a HTTPServer in python. The problem I am
>>>> having is once I have it thread, If I put it in the setUp method  and
>>>> tearDown I get port in use exception. Due to the nature of the thread it is
>>>> not guaranteed to be killed in time.
>>>>
>>>> Vitaly Babiy
>>>>
>>>>
>>>>
>>> You should be able to save the thread on the Test object during setup()
>>> and then kill it on teardown() shouldn't you?
>>>
>>> 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
>>>
>>>
>>>
>>
>>
>>
> What if you just put a time.sleep(2) at the end of tearDown() that should
> give the thread enough time to close before the next test starts.
>
>
> 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
-~--~~~~--~~--~--~---



Working with URL Fields in django test.

2009-02-08 Thread Vitaly Babiy
Hello,

If I am using a URLField in form and it set to verify the URL, if I write
tests for the code and in the post I push a url like *http:google.com *it
will fail if the computer is off-line. Is there a good fix for this?

Vitaly Babiy

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



Re: Testing Django and HTTP Request

2009-02-08 Thread Vitaly Babiy
Right the problem is if I reload the server on ever test, there is not
enough time for the thread to kill the server. So when the next setUp comes
around the port is still in use.
I think I need to find a way to start a HTTP server at the beginning of the
test and keep it around till all test are done. And have a way to tell the
server what to return on the request.

Vitaly Babiy


On Mon, Feb 9, 2009 at 12:08 AM, Alex Gaynor <alex.gay...@gmail.com> wrote:

>
>
> On Mon, Feb 9, 2009 at 12:06 AM, Vitaly Babiy <vbabi...@gmail.com> wrote:
>
>> Hello everyone,
>>
>> I am working on a project that will need to make a request out to the web
>> and pull down some data, For testing purpose I was wonder what would be the
>> best way to test this. I don't want to make the actual request during the
>> test, because for one if I am off-line all those tests will fail.
>>
>> I have tried to implement a HTTPServer in python. The problem I am having
>> is once I have it thread, If I put it in the setUp method  and tearDown I
>> get port in use exception. Due to the nature of the thread it is not
>> guaranteed to be killed in time.
>>
>> Vitaly Babiy
>>
>>
>>
> You should be able to save the thread on the Test object during setup() and
> then kill it on teardown() shouldn't you?
>
> 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
-~--~~~~--~~--~--~---



Testing Django and HTTP Request

2009-02-08 Thread Vitaly Babiy
Hello everyone,

I am working on a project that will need to make a request out to the web
and pull down some data, For testing purpose I was wonder what would be the
best way to test this. I don't want to make the actual request during the
test, because for one if I am off-line all those tests will fail.

I have tried to implement a HTTPServer in python. The problem I am having is
once I have it thread, If I put it in the setUp method  and tearDown I get
port in use exception. Due to the nature of the thread it is not guaranteed
to be killed in time.

Vitaly Babiy

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



Re: Django Continuous Integration

2009-02-04 Thread Vitaly Babiy
Has any one got hudson to work as a CI system.
Vitaly Babiy


On Wed, Jan 14, 2009 at 1:05 PM, Adam V. <fla...@gmail.com> wrote:

>
> > Revision Control: How do you layout your development repository?  I'm
> > using Subversion for my setup but would be interested in hearing what
> > else others are using (Mercurial, Bazaar, Git, etc)
>
> We're using Subversion. We have one big repository, but we treat it
> like two top-level repository, one for the website files themselves,
> and one for build scripts and other tools. We're a small shop (<6
> devs), so SVN is fine for what we're doing.
>
> > Packaging:  Django has an aversion to using setuptools and opts to
> > stick with the basics in distutils.  What are you using for packaging
> > your application?
>
> We're doing in-house development, so we don't package our project/app.
>
> > Buildbot:  Do you use Buildbot or something similar for your Django
> > development?  How does that work for you?  What other options are
> > there that would work well?
>
> We use CruiseControl.NET as our CI tool, since we're using that for
> our .NET development anyway.
> It watches SVN for changes and calls custom scripts written in Python
> that look a little like this:
> http://code.google.com/p/adamv/source/browse/python/buildsystem/
>
> > Versioning: How do you mark versions of your Django project?
> We're running against Django-trunk so far.
>
> > Migrations: What do you use to track database migrations?
> We're using MS SQL Server (since that's what our other stuff is in),
> and we're using a 3rd party commercial tool called "RedGate SQL
> Compare" to do schema upgrades. We keep our DB schema in source
> control as a set of SQL files that gets run to create a new, empty
> database.
>
> Since we're doing Django on top of a "legacy" database, our Django
> models don't own the bulk of the database, and SQL Compare is what our
> main .NET apps are using to update schemas when we deploy that stuff.
>
> >
>

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



Re: Getting Logged in User with Test Client

2009-01-29 Thread Vitaly Babiy
Malcolm thanks for the feedback and your right, I agree with you that the
client should not know about the user.
Vitaly Babiy


2009/1/26 Malcolm Tredinnick <malc...@pointy-stick.com>

>
> On Sat, 2009-01-24 at 12:14 -0500, Vitaly Babiy wrote:
> >  Yes either way would work I was just wondering if there was a more
> > cleaner way of doing so.
>
> Then you're going to have to define what "cleaner" means from your
> persepctive. What could be cleaner that simply get()-ing the right model
> based on the unique piece of identifying information (the username)?
> It's one line of code.
>
> The browser-emulating side (self.client) doesn't and shouldn't care
> about that, since it's the browser-side of the test, not the
> server-side.
>
> Regards,
> Malcolm
>
>
> >
>

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



Re: Import Fixtures per test

2009-01-24 Thread Vitaly Babiy
Yeah this is true, that would work. Thanks,
Vitaly Babiy


On Sat, Jan 24, 2009 at 12:38 PM, Alex Koshelev <daeva...@gmail.com> wrote:

> Extract this test to its own TestCase with needed fixtures.
>
>
> On Sat, Jan 24, 2009 at 8:15 PM, Vitaly Babiy <vbabi...@gmail.com> wrote:
>
>> Is there a way to specify which fixtures I want to import per test?
>>
>> Vitaly Babiy
>>
>>
>>
>
> >
>

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



Import Fixtures per test

2009-01-24 Thread Vitaly Babiy
Is there a way to specify which fixtures I want to import per test?

Vitaly Babiy

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



Re: Getting Logged in User with Test Client

2009-01-24 Thread Vitaly Babiy
Yes either way would work I was just wondering if there was a more cleaner
way of doing so.

Vitaly Babiy


On Sat, Jan 24, 2009 at 11:47 AM, Masklinn <maskl...@masklinn.net> wrote:

>
> On 24 Jan 2009, at 06:22 , Vbabiy wrote:
> >
> >def test_showAccountWithZeroTrackers(self):
> >self.client.login(username='user', password='test123')
> >
> > How can I get the user model when I use the client to login in to the
> > application?
> >
> Why not simply use `User.objects.get(username='user')`?
>
> >
>

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



Re: Your IDE of choice

2009-01-07 Thread Vitaly Babiy
Hey for gedit you should try my plug in
http://github.com/vbabiy/gedit-openfiles/tree/master
Vitaly Babiy


On Wed, Jan 7, 2009 at 10:08 AM, don ilicis <juve...@gmail.com> wrote:

>
>
> 2009/1/7 Kenneth Gonsalves <law...@thenilgiris.com>
>
>>
>> On Tuesday 06 Jan 2009 5:18:57 pm HB wrote:
>> > What is your favorite IDE for coding Django projects?
>>
>> geany
>>
>> --
>> regards
>> KG
>> http://lawgon.livejournal.com
>>
>>
>> me too
> and also gedit / vim
>
>
>
> >
>

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



Re: Your IDE of choice

2009-01-06 Thread Vitaly Babiy
Bernard does komodo have a open files function (open file in project based
on file name search) like there is text mate or gedit with plugin
(gedit-openfiles).

Vitaly Babiy


On Tue, Jan 6, 2009 at 3:10 PM, Bernard <bernard.ch...@gmail.com> wrote:

>
> I use Komodo IDE 5 everyday for every Python/Django/PHP/Drupal
> projects at work and damn it works well.
>
> What I love about it:
>
> * Key bindings(shortcuts) for almost everything
> * Simple subversion integration so I don't have to switch to another
> window to commit something.
> * Search & Replace , Regex toolkit
> * Code Snippets. I have plenty of those for Django templates, HTML,
> CSS, Python & PHP.
> * http://code.google.com/p/django-komodo-kit/ for more django goodness
> in Komodo Edit or IDE
>
> What I hate about it:
> * a little slow to start but once it's fired, there's nothing stopping
> it.
>
> what it looks like on my laptop :
>
> http://www.picoodle.com/view.php?img=/3/1/6/f_komodoidem_51d0317.png=img37
>
> On Jan 6, 6:48 am, HB <hubaghd...@gmail.com> wrote:
> > Hey,
> > What is your favorite IDE for coding Django projects?
> > Any ideas about PyDev and ActiveState Komodo IDE?
> > Thanks.
> >
>

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



Re: Your IDE of choice

2009-01-06 Thread Vitaly Babiy
Brain do you find it a little slow?

Vitaly Babiy


On Tue, Jan 6, 2009 at 12:00 PM, Brian <bjt...@gmail.com> wrote:

>
> For Python/Django I tend to like Komodo's Editor, as I am a fan of
> auto-complete and $free.
> >
>

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



Re: Your IDE of choice

2009-01-06 Thread Vitaly Babiy
I use Gedit in gnome and some plugins
Works well.

Vitaly Babiy


On Tue, Jan 6, 2009 at 11:45 AM, Santiago <santiago.j.zar...@gmail.com>wrote:

>
> i recently switched to screen + vim with omnicomplete for python and
> html...
>
> komodo edit its pretty good too
>
> 2009/1/7 martyn <andresmartinoc...@gmail.com>:
> >
> > Hi
> >
> > http://pyrox.utp.edu.co/
> >
> > Regards
> >
> > Bye.
> >
> > On Jan 6, 9:34 am, roberto <robertomariobeni...@gmail.com> wrote:
> >> I tried them all (almost ... I think... at least the free ones).
> >> - Pyscripter is really nice but it is true, it is only for windows.
> >> (If it is developed with python it should be platform-independent,
> >> shouldn' be ?) (no support for sql queries I think)
> >> - Eclipse + PyDev (no good support for sql queries to relational db)
> >> - Ulipad (open source / excellent / very small / some issues with
> >> svn / no support for sql queries to db - django plugin to highlight
> >> templates, etc)
> >> - Netbeans (ex-NBPython) it is excellent (very good sql support - some
> >> issues with memory consume - I didn't get debugger work 100% with
> >> django)
> >> - Oracle jdeveloper. it is an excellent tool. Its support for python
> >> is still too new and I think that django support is still to come.
> >> - Eric4: screenshots are very beautiful bu I couldn't get to install
> >> it in my ubuntu box (too many precedences and too complicated for a
> >> newbie like me).
> >>
> >> Have a great year 2009 everyone !
> >>
> >> On Jan 6, 9:02 am, "Trivedi, Apaar" <apaar.triv...@nymag.com> wrote:
> >>
> >> > I use Eclipse with PyDev and PyDev extensions.  I really like it, but
> I
> >> > prefer the eclipse sort of IDE's.
> >>
> >> > 
> >>
> >> > From: django-users@googlegroups.com
> >> > [mailto:django-us...@googlegroups.com] On Behalf Of Damien Hou
> >> > Sent: Tuesday, January 06, 2009 8:43 AM
> >> > To: django-users@googlegroups.com
> >> > Subject: Re: Your IDE of choice
> >>
> >> > TextMate with Django and Django Templates bundles is pretty neat
> >>
> >> > On Tue, Jan 6, 2009 at 7:48 PM, HB <hubaghd...@gmail.com> wrote:
> >>
> >> > Hey,
> >> > What is your favorite IDE for coding Django projects?
> >> > Any ideas about PyDev and ActiveState Komodo IDE?
> >> > Thanks.
> >>
> >> > --
> >> > Best Regards,
> >> > Damien
> > >
> >
>
> >
>

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



Re: Model Inheritance - And Signals

2008-11-07 Thread Vitaly Babiy
Thanks Alex that worked great.
Vitaly Babiy


On Fri, Nov 7, 2008 at 12:19 PM, Alex Koshelev <[EMAIL PROTECTED]> wrote:

> Try to connection handler without `sender` specified. And filter needed
> models inside it.
>
> def my_handler(sender, **kwargs):
> if not isinstance(sender, CustomModel):
>return
>
> signals.pre_save.connect(my_handler)
>
>
> On Fri, Nov 7, 2008 at 20:03, Vitaly Babiy <[EMAIL PROTECTED]> wrote:
>
>> if I define a model called CustomModel and I attach attach a pre_save
>> signal to it. Is there any way to have that signal be called any time model
>> that extends CustomModel is being saved has that method saved.
>>
>> I know i could do this by overriding the save method on CustomeModel but I
>> was wondering if there is any way to do it with signals.
>>
>> Thanks,
>> Vitaly Babiy
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Model Inheritance - And Signals

2008-11-07 Thread Vitaly Babiy
if I define a model called CustomModel and I attach attach a pre_save signal
to it. Is there any way to have that signal be called any time model that
extends CustomModel is being saved has that method saved.

I know i could do this by overriding the save method on CustomeModel but I
was wondering if there is any way to do it with signals.

Thanks,
Vitaly Babiy

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Mercurial or Git

2008-10-22 Thread Vitaly Babiy
I personally would recommend git.
Vitaly Babiy


On Wed, Oct 22, 2008 at 4:01 PM, john Moylan <[EMAIL PROTECTED]> wrote:

> You can already use git with an SVN server
>
>
>
> 2008/10/22 Rit Lim <[EMAIL PROTECTED]>
>
>
>> which one is the Django community moving toward to, mercurial or git?
>> if Django is to be moved...
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: www.djangosnippets.org is down now?

2008-10-22 Thread Vitaly Babiy
Peter that is a great Idea, I never thought of that.
Vitaly Babiy


On Wed, Oct 22, 2008 at 1:26 PM, Peter Bengtsson <[EMAIL PROTECTED]> wrote:

>
> When I get an error on viewing a snippet I copy the URL into Google
> and click the Cached version.
>
> On Oct 22, 5:08 pm, Gmail <[EMAIL PROTECTED]> wrote:
> > i found lots of snippets to download,but the server always says it is
> > down.
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---