Re: How to change the representation of newline?

2006-12-14 Thread zhongke chen
firefox shows utf-8

my firefox is 2.0

On 12/14/06, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote:
> And what encoding is showed in the page info? ...when you right click
> somewhere in the page and choose "View Page Info" from the menu. Maybe
> just the default character encoding in your firefox settings is set
> wrongly?
>
> You can always override admin templates copying them into your
> custom_templates/admin directory.
>
> Regards,
> Aidas Bendoraitis
>
>
>
> On 12/14/06, zhongke chen <[EMAIL PROTECTED]> wrote:
> > It's not my html page, but the django admin page.
> >
> > the head of admin page is like this:
> >
> >  > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> > http://www.w3.org/1999/xhtml"; lang="zh-cn" xml:lang="zh-cn" >
> > 
> > 站点管理员
> >  > href="/oj/adminmedia/css/dashboard.css" />
> > 
> >
> > no encoding here, but lang = 'zh-cn'.
> >
> > and all chinese characters in my pages and mysql are encoded in UTF-8.
> > Locale of my server is like this:
> >
> > LANG=zh_CN.UTF-8
> > LANGUAGE=zh_CN:zh:en_US:en
> > LC_CTYPE="zh_CN.UTF-8"
> > LC_NUMERIC="zh_CN.UTF-8"
> > LC_TIME="zh_CN.UTF-8"
> > LC_COLLATE="zh_CN.UTF-8"
> > LC_MONETARY="zh_CN.UTF-8"
> > LC_MESSAGES="zh_CN.UTF-8"
> > LC_PAPER="zh_CN.UTF-8"
> > LC_NAME="zh_CN.UTF-8"
> > LC_ADDRESS="zh_CN.UTF-8"
> > LC_TELEPHONE="zh_CN.UTF-8"
> > LC_MEASUREMENT="zh_CN.UTF-8"
> > LC_IDENTIFICATION="zh_CN.UTF-8"
> > LC_ALL=
> >
> >
> > On 12/13/06, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote:
> > > It might be that it treats new lines as \r\n when you are using some
> > > windows-* encoding for your html pages. Check the source code. I would
> > > rather use UTF-8 in any case.
> > >
> > > Regards
> > > Aidas Bendoraitis [aka Archatas]
> > >
> > >
> >
> > --
> > Yours, Zhongke Chen 陈忠克
> >
> > >
> >
>
> >
>


-- 
Yours, Zhongke Chen 陈忠克

欢迎访问温州本地Linux论坛:http://groups.google.com/group/linux-wz

[EMAIL PROTECTED]/excel/ppt文件给我,请先转成PDF格式。谢谢!PLEASE
contact me using [EMAIL PROTECTED] from now on. Other mail boxes
have been deprecated. If you want to attach word/excel/powerpoint
files for me, PLEASE convert them to pdf. Thanks a lot.

--~--~-~--~~~---~--~~
 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: How to change the representation of newline?

2006-12-14 Thread zhongke chen
It's not my html page, but the django admin page.

the head of admin page is like this:

http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
http://www.w3.org/1999/xhtml"; lang="zh-cn" xml:lang="zh-cn" >

站点管理员



no encoding here, but lang = 'zh-cn'.

and all chinese characters in my pages and mysql are encoded in UTF-8.
Locale of my server is like this:

LANG=zh_CN.UTF-8
LANGUAGE=zh_CN:zh:en_US:en
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=


On 12/13/06, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote:
> It might be that it treats new lines as \r\n when you are using some
> windows-* encoding for your html pages. Check the source code. I would
> rather use UTF-8 in any case.
>
> Regards
> Aidas Bendoraitis [aka Archatas]
>
>

-- 
Yours, Zhongke Chen 陈忠克

--~--~-~--~~~---~--~~
 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: How to change the representation of newline?

2006-12-13 Thread zhongke chen
thanks a lot. problem fixed as you said.

I use Firefox under linux. does it treat newline as \r\n??

On 12/11/06, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote:
> It seems that your browser treats new lines as under dos/windows. Is
> it Konqueror?
>
> I would suggest you to override the save method of your model,
> replacing new line characters to the preferred format:
>
> class MyModel(models.Model):
> body_text = models.TextField()
> ...
> def save(self):
> self.body_text = self.body_text.replace("\r\n", "\n").
> self.body_text = self.body_text.replace("\r", "\n").
> super(MyModel, self).save()
>
> Good luck!
> Aidas Bendoraitis [aka Archatas]
>
>
>
> On 12/10/06, zhongke chen <[EMAIL PROTECTED]> wrote:
> > When I input some text with newline characters in TextField under
> > admin page, I found that the newline character in database is
> > represented as \r\n. My django site is running at linux, other program
> > under linux always treat newline as \n. This cause some compatible
> > problems. How can I change the representation of newline?
> >
> > --
> > Yours, Zhongke Chen 陈忠克
> >
> > >
> >
>
> >
>


-- 
Yours, Zhongke Chen 陈忠克

欢迎访问温州本地Linux论坛:http://groups.google.com/group/linux-wz

[EMAIL PROTECTED]/excel/ppt文件给我,请先转成PDF格式。谢谢!PLEASE
contact me using [EMAIL PROTECTED] from now on. Other mail boxes
have been deprecated. If you want to attach word/excel/powerpoint
files for me, PLEASE convert them to pdf. Thanks a lot.

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



How to change the representation of newline?

2006-12-09 Thread zhongke chen
When I input some text with newline characters in TextField under
admin page, I found that the newline character in database is
represented as \r\n. My django site is running at linux, other program
under linux always treat newline as \n. This cause some compatible
problems. How can I change the representation of newline?

-- 
Yours, Zhongke Chen 陈忠克

--~--~-~--~~~---~--~~
 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: a conflict between django and php4

2006-09-18 Thread zhongke chen

Thanks! i solve this by removing libmhash package. but it's only a
workaround solution. i expect to see a perfect one.


On 9/19/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
> On Tue, 2006-09-19 at 12:52 +0800, zhongke chen wrote:
> > Not the same problem.
> >
> > if i enable php4, and i do not log in under django, my django app
> > works too. if i log in, error occurs.
>
> Could it possibly be a repeat of this problem:
>
> http://groups.google.com/group/django-users/browse_frm/thread/eeb44c894342d6f7/535749bbc456d296?lnk=gst&q=md5+problem&rnum=7#535749bbc456d296
>
> I'm not sure if there was ever a resolution to that one. There is
> another thread on the same list around that time (search for md5) with
> some related information, if memory serves.
>
> Regards,
> Malcolm
>
>
>
> >
>


-- 
from czk.
My old mail boxes([EMAIL PROTECTED], [EMAIL PROTECTED]) have been
deprecated. Please contact with me using the following email address
from now on: [EMAIL PROTECTED]
If you want to attach word/excel/powerpoint files for me, please
convert them to pdf. because i have no money to buy ms-office.

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



Re: a conflict between django and php4

2006-09-18 Thread zhongke chen

Not the same problem.

if i enable php4, and i do not log in under django, my django app
works too. if i log in, error occurs.

On 9/19/06, Bryan Murdock <[EMAIL PROTECTED]> wrote:
>
> On 9/18/06, zhongke chen <[EMAIL PROTECTED]> wrote:
> >
> > i'm using django with apache2. if i disable php4 module of
> > apache2(using a2dismod php4), my django application runs well. if i
> > enable php4 module and log a user in, my django application gives the
> > following error message:
> >
> > Mod_python error: "PythonHandler django.core.handlers.modpython"
> 
>
> Are you having this problem?
>
> http://www.modpython.org/FAQ/faqw.py?req=show&file=faq02.013.htp
>
> Bryan
>
> >
>


-- 
from czk.

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



a conflict between django and php4

2006-09-18 Thread zhongke chen

i'm using django with apache2. if i disable php4 module of
apache2(using a2dismod php4), my django application runs well. if i
enable php4 module and log a user in, my django application gives the
following error message:

Mod_python error: "PythonHandler django.core.handlers.modpython"

Traceback (most recent call last):

  File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line
299, in HandlerDispatch
result = object(req)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/handlers/modpython.py",
line 163, in handler
return ModPythonHandler()(req)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/handlers/modpython.py",
line 136, in __call__
response = self.get_response(req.uri, request)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/handlers/base.py",
line 59, in get_response
response = middleware_method(request)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/middleware/locale.py",
line 16, in process_request
language = translation.get_language_from_request(request)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/utils/translation/trans_real.py",
line 308, in get_language_from_request
lang_code = request.session.get('django_language', None)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/sessions/middleware.py",
line 35, in get
return self._session.get(key, default)

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/sessions/middleware.py",
line 57, in _get_session
self._session_cache = s.get_decoded()

  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/sessions/models.py",
line 65, in get_decoded
raise SuspiciousOperation, "User tampered with session cookie."

SuspiciousOperation: User tampered with session cookie.

i need to use php4 and django together, how can i solve it?appreciate any help

my system:
debian linux
kernal version 2.6.17-2-686
apache2 2.0.55-4.2
libapache2-mod-python 3.2.10-1
python 2.4.3
django 0.95

-- 
from czk.

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



Re: django cannot connect to mysql after upgrade

2006-08-22 Thread zhongke chen

There is no MySQLdb-python package in my system. There is a package
named python-mysqldb. I reinstalled it and the problem is still the
same.

My system is debian etch, python-mysqldb is 1.2.1, python 2.3 or
2.4(both have the same problem), django 0.95 or svn(both the same).


On 8/22/06, Spike^ekipS <[EMAIL PROTECTED]> wrote:
>
> Hi, chen.
> I got the same problems after updating my system.
> Just re-install MySQLdb-python modules.
>
>
> zhongke chen wrote:
> > After upgrade mysql from 5.0.22 to 5.0.24, django cannot work with
> > mysql. The error messages as following:
> > Traceback (most recent call last):
> >   File "./manage.py", line 11, in ?
> > execute_manager(settings)
> >   File 
> > "/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/management.py",
> > line 1343, in execute_manager
> > execute_from_command_line(action_mapping, argv)
> >   File 
> > "/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/management.py",
> > line 1260, in execute_from_command_line
> > action_mapping[action]()
> >   File 
> > "/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/management.py",
> > line 448, in syncdb
> > cursor = connection.cursor()
> >   File 
> > "/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/backends/mysql/base.py",
> > line 90, in cursor
> > self.connection = Database.connect(**kwargs)
> >   File "/usr/lib/python2.4/site-packages/MySQLdb/__init__.py", line
> > 75, in Connect
> > return Connection(*args, **kwargs)
> >   File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line
> > 207, in __init__
> > self.autocommit(False)
> > _mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you
> > can't run this command now")
> >
> >
> > --
> > from czk.
> > My old mail boxes([EMAIL PROTECTED], [EMAIL PROTECTED]) have been
> > deprecated. Please contact with me using the following email address
> > from now on: [EMAIL PROTECTED]
> > If you want to attach word/excel/powerpoint files for me, please
> > convert them to pdf. because i have no money to buy ms-office.
>
>
> >
>


-- 
from czk.
My old mail boxes([EMAIL PROTECTED], [EMAIL PROTECTED]) have been
deprecated. Please contact with me using the following email address
from now on: [EMAIL PROTECTED]
If you want to attach word/excel/powerpoint files for me, please
convert them to pdf. because i have no money to buy ms-office.

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



django cannot connect to mysql after upgrade

2006-08-21 Thread zhongke chen

After upgrade mysql from 5.0.22 to 5.0.24, django cannot work with
mysql. The error messages as following:
Traceback (most recent call last):
  File "./manage.py", line 11, in ?
execute_manager(settings)
  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/management.py",
line 1343, in execute_manager
execute_from_command_line(action_mapping, argv)
  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/management.py",
line 1260, in execute_from_command_line
action_mapping[action]()
  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/management.py",
line 448, in syncdb
cursor = connection.cursor()
  File 
"/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/backends/mysql/base.py",
line 90, in cursor
self.connection = Database.connect(**kwargs)
  File "/usr/lib/python2.4/site-packages/MySQLdb/__init__.py", line
75, in Connect
return Connection(*args, **kwargs)
  File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line
207, in __init__
self.autocommit(False)
_mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you
can't run this command now")


-- 
from czk.
My old mail boxes([EMAIL PROTECTED], [EMAIL PROTECTED]) have been
deprecated. Please contact with me using the following email address
from now on: [EMAIL PROTECTED]
If you want to attach word/excel/powerpoint files for me, please
convert them to pdf. because i have no money to buy ms-office.

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