On Mon, Dec 17, 2012 at 3:02 PM, dariyoosh <d.sunfor...@gmail.com> wrote:

> *Yes, I suspect so.  Try the following:
>>
>>     python manage.py shell
>>     import djangodblog
>>     djangodblog.__file__
>>
>> (That's two underscores on each side of the word file).  This will print
>> a string that I expect will end with '.../djangodblog/__init__.pyc'*
>> ***.  Whatever is there instead of "..." will tell you how to find the
>> djangdblog directory.  In it you will find both __init__.py and
>> middleware.py, and only in middleware.py will you find the definition of
>> DBLogMiddleware.
>> *
>>
>>
>>
>
> Many thanks for this interesting information. Here is the output of these
> commands:
>
> *$ python -tt manage.py shell*
> Python 2.7.3 (default, Jul 24 2012, 10:05:38)
> [GCC 4.7.0 20120507 (Red Hat 4.7.0-5)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
> >>>
> >>>
> >>> *import djangodblog*
> >>> *djangodblog.__file__*
> '/usr/lib/python2.7/site-packages/djangodblog/__init__.pyc'
> >>>
> *$ cat /usr/lib/python2.7/site-packages/djangodblog/middleware.py*
> import warnings
>
> __all__ = ('DBLogMiddleware',)
>
> class DBLogMiddleware(object):
>     """We now use signals"""
>     def process_exception(self, request, exception):
>         warnings.warn("DBLogMiddleware is no longer used.",
> DeprecationWarning)
> $
> $
> $ *cat /usr/lib/python2.7/site-packages/djangodblog/__init__.py*
> __version__ = (2, 2, 1)
> $
> $
>
>
> So it seems that my installation is different, in the book the author has
> used Django 1.1, whereas the version
> installed in my system is 1.4.2 Maybe the difference of the version
> explains the problem.
>

More likely it is a difference in the version of djangodblog, probably
having been made "more standard" since the book version.

>
> Thanks again for your time and your help.
>
> Regards,
> Dariyoosh
>
>
> On Monday, December 17, 2012 7:39:03 PM UTC+1, ke1g wrote:
>>
>>
>>
>> On Mon, Dec 17, 2012 at 12:41 PM, dariyoosh <d.sun...@gmail.com> wrote:
>>
>>> Hello there,
>>>
>>>
>>> Thank you very much for your time and your attention to my question.
>>> Your solution solved the problem !
>>>
>>> It works pretty well now. :)
>>>
>>> Just one question, initially I had written
>>> *'djangodblog.DBLogMiddleware'*
>>> simply because this was what author has suggested in the book.
>>>
>>> But now thanks to your solution, that is, *'djangodblog.middleware.
>>> DBLogMiddleware'*
>>> it works without any problem.
>>>
>>> So, does this mean that *'djangodblog.DBLogMiddleware'* is wrong? and
>>> therefore
>>> the author made a mistake that I have to report to the Errata web site
>>> of the book? or
>>> simply this is a component missing from my Django installation?
>>>
>>
>> Yes, I suspect so.  Try the following:
>>
>>     python manage.py shell
>>     import djangodblog
>>     djangodblog.__file__
>>
>> (That's two underscores on each side of the word file).  This will print
>> a string that I expect will end with '.../djangodblog/__init__.pyc'**.
>> Whatever is there instead of "..." will tell you how to find the djangdblog
>> directory.  In it you will find both __init__.py and middleware.py, and
>> only in middleware.py will you find the definition of DBLogMiddleware.
>> That's normal by convention.  There's no physical reason that
>> DBLogMiddleware could not have been defined in __init__.py, or imported
>> there from the middlware module, in which case your original
>> djangdblog.DBLogMiddleware would have worked.  But that's not the usual
>> convention.
>>
>>>
>>> Once again, thanks a lot for your help!
>>>
>>> Regards,
>>> Dariyoosh
>>>
>>>
>>>
>>>
>>> On Monday, December 17, 2012 6:04:01 PM UTC+1, ke1g wrote:
>>>>
>>>>
>>>> I don't have djangodblog handy, but, at a guess try changing settings
>>>> to use:
>>>>
>>>> *'djangodblog.middleware.DBLogMiddleware'*
>>>>
>>>> instead of:
>>>>
>>>> *'djangodblog.DBLogMiddleware'*
>>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To view this discussion on the web visit https://groups.google.com/d/**
>>> msg/django-users/-/o0OD_**xvrNhgJ<https://groups.google.com/d/msg/django-users/-/o0OD_xvrNhgJ>
>>> .
>>>
>>> To post to this group, send email to django...@googlegroups.com.
>>> To unsubscribe from this group, send email to django-users...@**
>>> googlegroups.com.
>>>
>>> For more options, visit this group at http://groups.google.com/**
>>> group/django-users?hl=en<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 view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/FEJZO3gCU4wJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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

Reply via email to