Re: Error while importing URLconf 'permitprint.urls': day is out of range for month

2012-02-29 Thread Kev Dwyer
furby wrote:

> Caught it.  Haha.  What a funny bug.  From models.py:
> 
> 196 d = dt.datetime.today()
> 197 expires = d.replace(year=d.year+1)
> 
> There is no Feb. 29th, 2013.  So this breaks.  Thx for the help!
> 
> On Feb 29, 9:50 am, Tom Evans  wrote:
>> On Wed, Feb 29, 2012 at 3:33 PM, furby  wrote:
>> > The guy I built this for does not want to pay me to maintain it, so
>> > it's still on .96.  And yet when something breaks randomly he wonders
>> > why.  Debug enabled today for debugging.  There is no dev
>> > environment.  Only production for this.
>>
>> Customer is always right. Plus, job for life ;)
>>
>>
>>
>> > Here's the urlconf.  I've literally commented out every urlpattern
>> > expect the top one on line 4.  Still breaks:
>>
>> > 1 from django.conf.urls.defaults import *
>> > 2 from permitprint.app.models import *
>> > 3 urlpatterns = patterns('django.views.generic.simple',
>> > 4 (r'^/?$', 'direct_to_template', {'template': 'index.html'}),
>> > 5 """
>>
>> Hmmpf. One of the things improved since 0.96 is that error reporting
>> of this kind has improved. There is an import error coming from one of
>> the imports in the urlconf, and that is why it cannot import the
>> urlconf. Is there any date handling code in the top level of the
>> permitprint.app.models?
>>
>> Cheers
>>
>> Tom
> 
Perhaps not entirely coincidentally, Michael Foord blogged about this today:

http://www.voidspace.org.uk/python/weblog/arch_d7_2012_02_25.shtml#e1235

Cheers,

Kev

-- 
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: Error while importing URLconf 'permitprint.urls': day is out of range for month

2012-02-29 Thread Andre Terra
use something like >>> d + datetime.timedelta(days=365)

http://docs.python.org/library/datetime.html#timedelta-objects


Cheers,
AT

On Wed, Feb 29, 2012 at 12:59 PM, furby  wrote:

> Caught it.  Haha.  What a funny bug.  From models.py:
>
> 196 d = dt.datetime.today()
> 197 expires = d.replace(year=d.year+1)
>
> There is no Feb. 29th, 2013.  So this breaks.  Thx for the help!
>
> On Feb 29, 9:50 am, Tom Evans  wrote:
> > On Wed, Feb 29, 2012 at 3:33 PM, furby  wrote:
> > > The guy I built this for does not want to pay me to maintain it, so
> > > it's still on .96.  And yet when something breaks randomly he wonders
> > > why.  Debug enabled today for debugging.  There is no dev
> > > environment.  Only production for this.
> >
> > Customer is always right. Plus, job for life ;)
> >
> >
> >
> > > Here's the urlconf.  I've literally commented out every urlpattern
> > > expect the top one on line 4.  Still breaks:
> >
> > >  1 from django.conf.urls.defaults import *
> > >  2 from permitprint.app.models import *
> > >  3 urlpatterns = patterns('django.views.generic.simple',
> > >  4 (r'^/?$', 'direct_to_template', {'template': 'index.html'}),
> > >  5 """
> >
> > Hmmpf. One of the things improved since 0.96 is that error reporting
> > of this kind has improved. There is an import error coming from one of
> > the imports in the urlconf, and that is why it cannot import the
> > urlconf. Is there any date handling code in the top level of the
> > permitprint.app.models?
> >
> > Cheers
> >
> > Tom
>
> --
> 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.
>
>

-- 
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: Error while importing URLconf 'permitprint.urls': day is out of range for month

2012-02-29 Thread furby
Caught it.  Haha.  What a funny bug.  From models.py:

196 d = dt.datetime.today()
197 expires = d.replace(year=d.year+1)

There is no Feb. 29th, 2013.  So this breaks.  Thx for the help!

On Feb 29, 9:50 am, Tom Evans  wrote:
> On Wed, Feb 29, 2012 at 3:33 PM, furby  wrote:
> > The guy I built this for does not want to pay me to maintain it, so
> > it's still on .96.  And yet when something breaks randomly he wonders
> > why.  Debug enabled today for debugging.  There is no dev
> > environment.  Only production for this.
>
> Customer is always right. Plus, job for life ;)
>
>
>
> > Here's the urlconf.  I've literally commented out every urlpattern
> > expect the top one on line 4.  Still breaks:
>
> >  1 from django.conf.urls.defaults import *
> >  2 from permitprint.app.models import *
> >  3 urlpatterns = patterns('django.views.generic.simple',
> >  4     (r'^/?$', 'direct_to_template', {'template': 'index.html'}),
> >  5 """
>
> Hmmpf. One of the things improved since 0.96 is that error reporting
> of this kind has improved. There is an import error coming from one of
> the imports in the urlconf, and that is why it cannot import the
> urlconf. Is there any date handling code in the top level of the
> permitprint.app.models?
>
> Cheers
>
> Tom

-- 
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: Error while importing URLconf 'permitprint.urls': day is out of range for month

2012-02-29 Thread Tom Evans
On Wed, Feb 29, 2012 at 3:33 PM, furby  wrote:
> The guy I built this for does not want to pay me to maintain it, so
> it's still on .96.  And yet when something breaks randomly he wonders
> why.  Debug enabled today for debugging.  There is no dev
> environment.  Only production for this.

Customer is always right. Plus, job for life ;)

>
> Here's the urlconf.  I've literally commented out every urlpattern
> expect the top one on line 4.  Still breaks:
>
>  1 from django.conf.urls.defaults import *
>  2 from permitprint.app.models import *
>  3 urlpatterns = patterns('django.views.generic.simple',
>  4     (r'^/?$', 'direct_to_template', {'template': 'index.html'}),
>  5 """

Hmmpf. One of the things improved since 0.96 is that error reporting
of this kind has improved. There is an import error coming from one of
the imports in the urlconf, and that is why it cannot import the
urlconf. Is there any date handling code in the top level of the
permitprint.app.models?

Cheers

Tom

-- 
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: Error while importing URLconf 'permitprint.urls': day is out of range for month

2012-02-29 Thread furby
The guy I built this for does not want to pay me to maintain it, so
it's still on .96.  And yet when something breaks randomly he wonders
why.  Debug enabled today for debugging.  There is no dev
environment.  Only production for this.

Here's the urlconf.  I've literally commented out every urlpattern
expect the top one on line 4.  Still breaks:

  1 from django.conf.urls.defaults import *
  2 from permitprint.app.models import *
  3 urlpatterns = patterns('django.views.generic.simple',
  4 (r'^/?$', 'direct_to_template', {'template': 'index.html'}),
  5 """
  6 (r'^contact/?$', 'direct_to_template', {'template':
'contact.html'}),
  7 (r'^services/?$', 'direct_to_template', {'template':
'services.html'}),
  8 (r'^cancel/?$', 'direct_to_template', {'template':
'cancel.html'}),
  9
 10 # Uncomment this for admin:
 11 """
 12 )
 13 """
 14 urlpatterns = patterns('',
 15 (r'^register/(?P\w+)/?$',
'permitprint.app.views.register'),
 16 (r'^register/?$', 'permitprint.app.views.register'),
 17 (r'^success/?$', 'permitprint.app.views.success'),
 18 (r'^cancel/?$', 'permitprint.app.views.cancel'),
 19 (r'^success-login/?$', 'permitprint.app.views.success_login'),
 20 (r'^verify/?$', 'permitprint.app.views.verify'),
 21 (r'^cancel-order-permits/?$',
'permitprint.app.views.cancel_order_permits'),
 22 (r'^success-order-permits/?$',
'permitprint.app.views.success_order_permits'),
 23 (r'^review-order-permits/?$',
'permitprint.app.views.review_order_permits'),
 24 (r'^admin/app/parkingpermit/$',
'permitprint.app.admin.views.main.change_list',
{'app_label':'app','model_name':'ParkingPermit'}),
 25 (r'^admin/app/userprofile/$',
'permitprint.app.admin.views.main.change_list',
{'app_label':'app','model_name':'UserProfile'}),
 26 (r'^admin/app/orderpermits/$',
'permitprint.app.views.order_permits'),
 27 (r'^admin/', include('permitprint.admin_urls')),
 28 )
 29 urlpatterns += patterns('django.views.generic.list_detail',
 30 (r'^products/?$', 'object_list', product_list ),
 31 (r'^products/(?P\w+)/?$', 'object_detail',
product_detail ),
 32 (r'^links/?$', 'object_list', link_list ),
 33 )
 34 """


On Feb 29, 9:22 am, Tom Evans  wrote:
> On Wed, Feb 29, 2012 at 3:09 PM, furby  wrote:
> > A site I built several years ago is breaking randomly today due to the
> > extra leap year day.  Any help on this would be appreciated.  I can't
> > track it down.
>
> > Traceback (most recent call last):
> > File "/home/nolenjb/django/django_src/django/core/handlers/base.py" in
> > get_response
> >  68. callback, callback_args, callback_kwargs =
> > resolver.resolve(request.path)
> > File "/home/nolenjb/django/django_src/django/core/urlresolvers.py" in
> > resolve
> >  160. for pattern in self.urlconf_module.urlpatterns:
> > File "/home/nolenjb/django/django_src/django/core/urlresolvers.py" in
> > _get_urlconf_module
> >  180. raise ImproperlyConfigured, "Error while importing URLconf %r:
> > %s" % (self.urlconf_name, e)
>
> >  ImproperlyConfigured at /admin/
> >  Error while importing URLconf 'permitprint.urls': day is out of
> > range for month
>
> So, it is going wrong because something that is in your urlconf causes
> an exception, and so the urlconf cannot be imported. You need to show
> the code from your urlconf.
>
> Two other unrelated things:
>
> 1) You're running with DEBUG=True on a production site! Don't do that!
> 2) You seem to be using Django 0.96! Django 1.4 is about to be
> released, there are 'several' bugs fixed in between those two
> versions. Perhaps even something that causes this problem!
>
> Cheers
>
> Tom

-- 
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: Error while importing URLconf 'permitprint.urls': day is out of range for month

2012-02-29 Thread Tom Evans
On Wed, Feb 29, 2012 at 3:09 PM, furby  wrote:
> A site I built several years ago is breaking randomly today due to the
> extra leap year day.  Any help on this would be appreciated.  I can't
> track it down.
>
> Traceback (most recent call last):
> File "/home/nolenjb/django/django_src/django/core/handlers/base.py" in
> get_response
>  68. callback, callback_args, callback_kwargs =
> resolver.resolve(request.path)
> File "/home/nolenjb/django/django_src/django/core/urlresolvers.py" in
> resolve
>  160. for pattern in self.urlconf_module.urlpatterns:
> File "/home/nolenjb/django/django_src/django/core/urlresolvers.py" in
> _get_urlconf_module
>  180. raise ImproperlyConfigured, "Error while importing URLconf %r:
> %s" % (self.urlconf_name, e)
>
>  ImproperlyConfigured at /admin/
>  Error while importing URLconf 'permitprint.urls': day is out of
> range for month
>

So, it is going wrong because something that is in your urlconf causes
an exception, and so the urlconf cannot be imported. You need to show
the code from your urlconf.

Two other unrelated things:

1) You're running with DEBUG=True on a production site! Don't do that!
2) You seem to be using Django 0.96! Django 1.4 is about to be
released, there are 'several' bugs fixed in between those two
versions. Perhaps even something that causes this problem!

Cheers

Tom

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



Error while importing URLconf 'permitprint.urls': day is out of range for month

2012-02-29 Thread furby
A site I built several years ago is breaking randomly today due to the
extra leap year day.  Any help on this would be appreciated.  I can't
track it down.

Traceback (most recent call last):
File "/home/nolenjb/django/django_src/django/core/handlers/base.py" in
get_response
  68. callback, callback_args, callback_kwargs =
resolver.resolve(request.path)
File "/home/nolenjb/django/django_src/django/core/urlresolvers.py" in
resolve
  160. for pattern in self.urlconf_module.urlpatterns:
File "/home/nolenjb/django/django_src/django/core/urlresolvers.py" in
_get_urlconf_module
  180. raise ImproperlyConfigured, "Error while importing URLconf %r:
%s" % (self.urlconf_name, e)

  ImproperlyConfigured at /admin/
  Error while importing URLconf 'permitprint.urls': day is out of
range for month

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