Re: django on FreeBDS
Hi, On Jul 14, 8:52 am, Przemek Gawronski <[EMAIL PROTECTED]> wrote: > Hi, a hosting company has installed django for me on their system > (FreeBSD 6.2-RELEASE-p5). When I try to run (ssh under jailshell): > bytes += read(_urandomfd, n - len(bytes)) > OSError: [Errno 6] Device not configured I am not expert neither in Jail or FreeBSD, but it seems obvious that they did not configured "random" device into jail. So I think you shoul ask them to include support for random into jail. May be even simple thing like: mknod dev/random c 1 8 under 'root' of this jail will help you, but I am not sure and probably you can try and if not works, ask FreeBSD expert. Alex --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
django on FreeBDS
Hi, a hosting company has installed django for me on their system (FreeBSD 6.2-RELEASE-p5). When I try to run (ssh under jailshell): 'django-admin.py startproject test' I get: Traceback (most recent call last): File "/usr/local/bin/django-admin.py", line 5, in ? management.execute_from_command_line() File "/usr/local/lib/python2.4/site-packages/django/core/management.py", line 1599, in execute_from_command_line action_mapping[action](name, os.getcwd()) File "/usr/local/lib/python2.4/site-packages/django/core/management.py", line 791, in startproject from random import choice File "/usr/local/lib/python2.4/random.py", line 834, in ? _inst = Random() File "/usr/local/lib/python2.4/random.py", line 94, in __init__ self.seed(x) File "/usr/local/lib/python2.4/random.py", line 108, in seed a = long(_hexlify(_urandom(16)), 16) File "/usr/local/lib/python2.4/os.py", line 723, in urandom bytes += read(_urandomfd, n - len(bytes)) OSError: [Errno 6] Device not configured Is there something wrong with the installation? Do I have ask the admin to do something more? Przemek -- AIKIDO TANREN DOJO - Poland - Warsaw - Mokotow - Ursynow - Natolin info: http://www.tanren.pl/ phone: +4850151 email: [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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: Looking for 2 great python/django developers in Atlanta area
On Sat, 2007-07-14 at 13:46 +1000, Malcolm Tredinnick wrote: > Umm... the world is a fairly big place. Where in it are you located? > > Malcolm See subject. :-) --~--~-~--~~~---~--~~ 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: model subclassing
On Fri, 2007-07-13 at 21:31 -0500, Carl Karsten wrote: > I am experimenting with subclassing a model. The parent class will be an > abstract class that does not get 'managed' by django. Only the subclass > will, > and the table the subclass works with will have all the fields. > > syncdb was able to create the table I expected, the admin let me add and save > it, but then when I went to view it, error: > > ProgrammingError at /admin/core/message/1/ > (1146, "Table 'djangodb.msg_abmessage' doesn't exist") > > (full details below) > > So is this just a small bug in the Admin, or is this totally unsupported and > I > should give up now? Currently unsupported. Work in progress at the moment and will be available before 1.0. Regards, Malcolm -- If Barbie is so popular, why do you have to buy her friends? http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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: Looking for 2 great python/django developers in Atlanta area
On Fri, 2007-07-13 at 16:47 +, Chris H. wrote: > Our web development team is looking for experienced Python/Django Web > developers. > > We're a small group practicing agile and rapid development looking to > grow bigger. > > This is not a typical, "hand me a spec and I'll build it" shop. We > play an integral role in shaping products, and then building them. We > have a vision for a product, work with key stakeholders, and build it. > Strong communication and people skills are required. > > Candidates with a background in journalism/publishing/media, or at > least a healthy respect for it, would be great. > > Further, candidates who have contributed to open-source projects, and/ > or have a strong attraction to open-source technologies, are > preferred. If your looking for a job with excitement and fast-paced > development, look no further. > > We recently started doing "Google 20% time" and would love to have our > developers help contribute back to Django! We also are big fans of > telecommuting days and flexible hours. Umm... the world is a fairly big place. Where in it are you located? Malcolm -- Works better when plugged in. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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: Difference between a model's field and it's translated version - admin
On Fri, 2007-07-13 at 16:19 +, Panos Laganakos wrote: > If I have the model specified as: > > class Candy(models.Model): > name = models.CharField(_('name'), maxlength=25) > > The admin section, displays the field as, 'Name', while the translated > version will appear as 'onoma', ie, the first letter isn't > capitalized. > > The translated word is specified all lower-case in the .po file. > > Is it possible to have the admin section, display it with the first > letter capitalized when appropriate? This has been fixed on trunk. There were a number of problems with delayed translations in cases like thisback in 0.96. The Unicode merge should have fixed all the known ones. Regards, Malcolm -- Success always occurs in private and failure in full view. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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: installation issues
Sorry about that. Thanks for the tip on using copy/paste. Here's the result for that: new-host-3:~ wdavis$ python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages On Jul 13, 6:49 pm, Carl Karsten <[EMAIL PROTECTED]> wrote: > you missed the -c > > guessing you need to figure out how to cut/paste into your terminal. I think > it > is action-v for paste, where action is the cloverleaf. > > Carl K > > surfwizz wrote: > > Here's what that looks like: > > new-host-3:~ wdavis$ python "from distutils.sysconfig import > > get_python_lib; print get_python_lib()" > > /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/ > > Contents/MacOS/Python: can't open file 'from distutils.sysconfig > > import get_python_lib; print get_python_lib()': [Errno 2] No such file > > or directory > > new-host-3:~ wdavis$ > > > On Jul 13, 6:16 pm, Carl Karsten <[EMAIL PROTECTED]> wrote: > >> run this command, show us what you get: > >> python -c "from distutils.sysconfig import get_python_lib; print > >> get_python_lib()" > > >> So like this: > > >> [EMAIL PROTECTED]:~$ python -c "from distutils.sysconfig import > >> get_python_lib; print > >> get_python_lib()" > >> /usr/lib/python2.5/site-packages > > >> Carl K > > >> surfwizz wrote: > >>> I could not find any folders at the lib location. To clarify how the > >>> IDLE thing went, I tried running sudo python setup.py, but it didn't > >>> work, so I opened setup.py in IDLE, Then went to 'run', in the > >>> menubar, and clicked 'run module'. It prompted me to save it, so I > >>> did. that was the whole python IDLE thing with this. > >>> On Jul 13, 3:40 am, "Dirk van Oosterbosch, IR labs" > >>> <[EMAIL PROTECTED]> wrote: > On 13-jul-2007, at 5:42, surfwizz wrote: > > I installed python fromwww.python.org, so the command prompt opens it > > into 2.5.1. That's what I tried to install django into. > Can you confirm that django is installed at this location? > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- > packages/django/ > (try 'locate django' in the Terminal to find out where all of django is) > > [...] so I just ran setup.py in IDLE as a module. Is there a way > > to fix this, or get this install running properly? > What do you mean 'in IDLE as a module'? AFAIK the correct way to > install python packages is to run 'sudo python setup.py' from the > normal command line. Or did you do that? > best > dirk --~--~-~--~~~---~--~~ 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: model subclassing
Carl Karsten wrote: > I am experimenting with subclassing a model. The parent class will be an > abstract class that does not get 'managed' by django. Only the subclass > will, > and the table the subclass works with will have all the fields. > > syncdb was able to create the table I expected, the admin let me add and save > it, but then when I went to view it, error: > > ProgrammingError at /admin/core/message/1/ > (1146, "Table 'djangodb.msg_abmessage' doesn't exist") > > (full details below) > > So is this just a small bug in the Admin, or is this totally unsupported and > I > should give up now? Sorry, bad news, look for the word "subclassing" at http://code.djangoproject.com. /L --~--~-~--~~~---~--~~ 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 subclassing
I am experimenting with subclassing a model. The parent class will be an abstract class that does not get 'managed' by django. Only the subclass will, and the table the subclass works with will have all the fields. syncdb was able to create the table I expected, the admin let me add and save it, but then when I went to view it, error: ProgrammingError at /admin/core/message/1/ (1146, "Table 'djangodb.msg_abmessage' doesn't exist") (full details below) So is this just a small bug in the Admin, or is this totally unsupported and I should give up now? carl K # msg/model.py from django.db import models from django.contrib.auth.models import User class abMessage(models.Model): to = models.ForeignKey(User, related_name = "messages_received") sender = models.ForeignKey(User, related_name = "messages_sent") subject = models.CharField(maxlength=50) sent = models.DateTimeField() recieved = models.DateTimeField() read = models.BooleanField() message = models.TextField() def __str__(self): return self.subject # core/models.py import msg.models class message(msg.models.abMessage): status = models.CharField(maxlength=1) class Admin: pass mysql> describe core_message; +---+-+--+-+-++ | Field | Type| Null | Key | Default | Extra | +---+-+--+-+-++ | id| int(11) | NO | PRI | NULL| auto_increment | | to_id | int(11) | NO | MUL | || | sender_id | int(11) | NO | MUL | || | subject | varchar(50) | NO | | || | sent | datetime| NO | | || | recieved | datetime| NO | | || | read | tinyint(1) | NO | | || | message | longtext| NO | | || | status| varchar(1) | NO | | || +---+-+--+-+-++ 9 rows in set (0.01 sec) mysql> select * from core_message; ++---+---+-+-+-+--+---++ | id | to_id | sender_id | subject | sent| recieved | read | message | status | ++---+---+-+-+-+--+---++ | 1 | 1 | 137 | are | 2007-07-13 21:11:57 | 2007-07-13 21:11:58 | 1 | asdfasdf | a | ++---+---+-+-+-+--+---++ 1 row in set (0.00 sec) ProgrammingError at /admin/core/message/1/ (1146, "Table 'djangodb.msg_abmessage' doesn't exist") Request Method: GET Request URL:http://dell29:8000/admin/core/message/1/ Exception Type: ProgrammingError Exception Value:(1146, "Table 'djangodb.msg_abmessage' doesn't exist") Exception Location: /usr/lib/python2.5/site-packages/MySQLdb/connections.py in defaulterrorhandler, line 35 Python Executable: /usr/bin/python Python Version: 2.5.1 Traceback (innermost last) Switch to copy-and-paste view * /usr/lib/python2.5/site-packages/django/core/handlers/base.py in get_response 70. # Apply view middleware 71. for middleware_method in self._view_middleware: 72. response = middleware_method(request, callback, callback_args, callback_kwargs) 73. if response: 74. return response 75. 76. try: 77. response = callback(request, *callback_args, **callback_kwargs) ... 78. except Exception, e: 79. # If the view raised an exception, run it through exception 80. # middleware, and if the exception middleware returns a 81. # response, use that. Otherwise, reraise the exception. 82. for middleware_method in self._exception_middleware: 83. response = middleware_method(request, e) ? Local vars Variable Value callback callback_args (u'core', u'message', u'1') callback_kwargs {} debug e ProgrammingError(1146, "Table 'djangodb.msg_abmessage' doesn't exist") exceptions mail_admins middleware_method > request , POST:, COOKIES:{'sessionid': '33017c5d30752deb58d94a20dbe9f1eb'}, META:{'CONTENT_LENGTH': '', 'CONTENT_TYPE': 'text/plain', 'DISPLAY': 'localhost:14.0', 'DJANGO_SETTINGS_MODULE': 'ridgemoor.settings', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HISTCONTROL': 'ignoreboth', 'HOME': '/home/carl', 'HTTP_ACCEPT': 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/pn
Re: Users?
Check out the Django-registration package on http://code.google.com/p/django-registration that has all the features that you require. --~--~-~--~~~---~--~~ 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: installation issues
you missed the -c guessing you need to figure out how to cut/paste into your terminal. I think it is action-v for paste, where action is the cloverleaf. Carl K surfwizz wrote: > Here's what that looks like: > new-host-3:~ wdavis$ python "from distutils.sysconfig import > get_python_lib; print get_python_lib()" > /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/ > Contents/MacOS/Python: can't open file 'from distutils.sysconfig > import get_python_lib; print get_python_lib()': [Errno 2] No such file > or directory > new-host-3:~ wdavis$ > > > On Jul 13, 6:16 pm, Carl Karsten <[EMAIL PROTECTED]> wrote: >> run this command, show us what you get: >> python -c "from distutils.sysconfig import get_python_lib; print >> get_python_lib()" >> >> So like this: >> >> [EMAIL PROTECTED]:~$ python -c "from distutils.sysconfig import >> get_python_lib; print >> get_python_lib()" >> /usr/lib/python2.5/site-packages >> >> Carl K >> >> surfwizz wrote: >>> I could not find any folders at the lib location. To clarify how the >>> IDLE thing went, I tried running sudo python setup.py, but it didn't >>> work, so I opened setup.py in IDLE, Then went to 'run', in the >>> menubar, and clicked 'run module'. It prompted me to save it, so I >>> did. that was the whole python IDLE thing with this. >>> On Jul 13, 3:40 am, "Dirk van Oosterbosch, IR labs" >>> <[EMAIL PROTECTED]> wrote: On 13-jul-2007, at 5:42, surfwizz wrote: > I installed python fromwww.python.org, so the command prompt opens it > into 2.5.1. That's what I tried to install django into. Can you confirm that django is installed at this location? /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/django/ (try 'locate django' in the Terminal to find out where all of django is) > [...] so I just ran setup.py in IDLE as a module. Is there a way > to fix this, or get this install running properly? What do you mean 'in IDLE as a module'? AFAIK the correct way to install python packages is to run 'sudo python setup.py' from the normal command line. Or did you do that? best dirk > > > > > --~--~-~--~~~---~--~~ 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: installation issues
Here's what that looks like: new-host-3:~ wdavis$ python "from distutils.sysconfig import get_python_lib; print get_python_lib()" /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/ Contents/MacOS/Python: can't open file 'from distutils.sysconfig import get_python_lib; print get_python_lib()': [Errno 2] No such file or directory new-host-3:~ wdavis$ On Jul 13, 6:16 pm, Carl Karsten <[EMAIL PROTECTED]> wrote: > run this command, show us what you get: > python -c "from distutils.sysconfig import get_python_lib; print > get_python_lib()" > > So like this: > > [EMAIL PROTECTED]:~$ python -c "from distutils.sysconfig import > get_python_lib; print > get_python_lib()" > /usr/lib/python2.5/site-packages > > Carl K > > surfwizz wrote: > > I could not find any folders at the lib location. To clarify how the > > IDLE thing went, I tried running sudo python setup.py, but it didn't > > work, so I opened setup.py in IDLE, Then went to 'run', in the > > menubar, and clicked 'run module'. It prompted me to save it, so I > > did. that was the whole python IDLE thing with this. > > > On Jul 13, 3:40 am, "Dirk van Oosterbosch, IR labs" > > <[EMAIL PROTECTED]> wrote: > >> On 13-jul-2007, at 5:42, surfwizz wrote: > > >>> I installed python fromwww.python.org, so the command prompt opens it > >>> into 2.5.1. That's what I tried to install django into. > >> Can you confirm that django is installed at this location? > >> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- > >> packages/django/ > >> (try 'locate django' in the Terminal to find out where all of django is) > > >>> [...] so I just ran setup.py in IDLE as a module. Is there a way > >>> to fix this, or get this install running properly? > >> What do you mean 'in IDLE as a module'? AFAIK the correct way to > >> install python packages is to run 'sudo python setup.py' from the > >> normal command line. Or did you do that? > > >> best > >> dirk --~--~-~--~~~---~--~~ 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: installation issues
run this command, show us what you get: python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" So like this: [EMAIL PROTECTED]:~$ python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" /usr/lib/python2.5/site-packages Carl K surfwizz wrote: > I could not find any folders at the lib location. To clarify how the > IDLE thing went, I tried running sudo python setup.py, but it didn't > work, so I opened setup.py in IDLE, Then went to 'run', in the > menubar, and clicked 'run module'. It prompted me to save it, so I > did. that was the whole python IDLE thing with this. > > On Jul 13, 3:40 am, "Dirk van Oosterbosch, IR labs" > <[EMAIL PROTECTED]> wrote: >> On 13-jul-2007, at 5:42, surfwizz wrote: >> >>> I installed python fromwww.python.org, so the command prompt opens it >>> into 2.5.1. That's what I tried to install django into. >> Can you confirm that django is installed at this location? >> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- >> packages/django/ >> (try 'locate django' in the Terminal to find out where all of django is) >> >>> [...] so I just ran setup.py in IDLE as a module. Is there a way >>> to fix this, or get this install running properly? >> What do you mean 'in IDLE as a module'? AFAIK the correct way to >> install python packages is to run 'sudo python setup.py' from the >> normal command line. Or did you do that? >> >> best >> dirk > > > > > --~--~-~--~~~---~--~~ 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: installation issues
I could not find any folders at the lib location. To clarify how the IDLE thing went, I tried running sudo python setup.py, but it didn't work, so I opened setup.py in IDLE, Then went to 'run', in the menubar, and clicked 'run module'. It prompted me to save it, so I did. that was the whole python IDLE thing with this. On Jul 13, 3:40 am, "Dirk van Oosterbosch, IR labs" <[EMAIL PROTECTED]> wrote: > On 13-jul-2007, at 5:42, surfwizz wrote: > > > I installed python fromwww.python.org, so the command prompt opens it > > into 2.5.1. That's what I tried to install django into. > > Can you confirm that django is installed at this location? > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- > packages/django/ > (try 'locate django' in the Terminal to find out where all of django is) > > > [...] so I just ran setup.py in IDLE as a module. Is there a way > > to fix this, or get this install running properly? > > What do you mean 'in IDLE as a module'? AFAIK the correct way to > install python packages is to run 'sudo python setup.py' from the > normal command line. Or did you do that? > > best > dirk --~--~-~--~~~---~--~~ 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: form processing
Thanks for your help I was not understanding why I could not get both values. On Jul 13, 3:10 pm, "Jonathan Buchanan" <[EMAIL PROTECTED]> wrote: > > I have a form on one of my pages that has two fields with the same > > name. When I process the POST in my view I only get one of the values > > ( the last one ). > > > EXAMPLE: > > HTML > > > > > > > DEBUG > > POST: > > > VIEW > > request.POST['version'] > > > the above line is = 35 if both checkboxes are checked > > > any ideas why I don't get a list with (38,35)? > > You have to use the getlist method [1] to retrieve a list of parameters: > > request.POST.getlist('version') > > Regards, > Jonathan. > > [1]http://www.djangoproject.com/documentation/request_response/#querydic... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Users?
How would I make a site that has Users that can register/make a profile? --~--~-~--~~~---~--~~ 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: Does anybody know how to make a PICTURE database in Django???
On Jul 13, 10:49 pm, Naco <[EMAIL PROTECTED]> wrote: > Im a newby looking for some instructions on building a picture > database that is indexed. Would anybody know, have some instrucitons > or help out a newby That's really specific and all :) This might be of interest for you: http://www.carcosa.net/jason/software/django/stockphoto/ --~--~-~--~~~---~--~~ 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: html sanitizers
wow, this lib is great. danke. heh, love that feeling that i've been wasting my life coding scrapers with regexs up until now... :) patrick k. wrote: > it´s easy to write a customized sanitizer using beautifulsoup. > http://www.crummy.com/software/BeautifulSoup/ > > 1) place beautifulsoup.py somewhere in your pythonpath > 2) build your sanitizer and save it somewhere on your pythonpath > in my case it´s called eatMe and looks like this: > http://dpaste.com/hold/14305/ > > your sanitizer will probably be less complicated ... > > 3) in your models.py, do something like this: > > def isGoodHTML(field_data, all_data): > from eatMe import doEatMe > if field_data: > new_field_data = doEatMe(field_data) > if new_field_data != all_data['summary']: > all_data['summary'] = new_field_data > raise validators.ValidationError, "The errors in your > document were automatically corrected. Please check again!" > > isGoodHTML.always_test = True > > ... > > summary = models.TextField(validator_list=[isGoodHTML]) > > note: I know this looks complicated, but if you built your sanitizer > once you can always reconfigure and reuse it. > we use the above example for text-fields in the admin (with TinyMCE). > > patrick > > Am 13.07.2007 um 11:23 schrieb Derek Anderson: > >> hey all, >> >> could anyone point me to a python html sanitizer implementation (or >> example)? i don't mean to strip all html, just tags and attributes >> not >> on a whitelist, such as I/B/A href/U/etc. >> >> danke, >> derek >> > > > > > --~--~-~--~~~---~--~~ 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: form processing
> I have a form on one of my pages that has two fields with the same > name. When I process the POST in my view I only get one of the values > ( the last one ). > > EXAMPLE: > HTML > > > > DEBUG > POST: > > VIEW > request.POST['version'] > > the above line is = 35 if both checkboxes are checked > > any ideas why I don't get a list with (38,35)? You have to use the getlist method [1] to retrieve a list of parameters: request.POST.getlist('version') Regards, Jonathan. [1] http://www.djangoproject.com/documentation/request_response/#querydict-objects --~--~-~--~~~---~--~~ 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: form processing
The second value is overwriting the first. I don't think you can return a list unless you use a multi-select box. On Jul 13, 2:45 pm, Mackenzie <[EMAIL PROTECTED]> wrote: > I have a form on one of my pages that has two fields with the same > name. When I process the POST in my view I only get one of the values > ( the last one ). > > EXAMPLE: > HTML > > > > DEBUG > POST: > > VIEW > request.POST['version'] > > the above line is = 35 if both checkboxes are checked > > any ideas why I don't get a list with (38,35)? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Does anybody know how to make a PICTURE database in Django???
Im a newby looking for some instructions on building a picture database that is indexed. Would anybody know, have some instrucitons or help out a newby --~--~-~--~~~---~--~~ 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: Errors in installing Django Trunk version on Windows xp
thanks for help, properly it works when passing the appropriate parameters. i was running it without passing parameters. sorry ,just started with Django ! On Jul 13, 8:09 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > Looks like you've got a couple of problems. First the traceback seems to > indicate that django-admin doesn't like whatever arguments you have passed > to it, so it attempts to print out its usage message. However then Python > hiccups attempting to convert the message into your command prompt's code > page. From this page: > > http://sourceforge.net/tracker/index.php?func=detail&aid=1616979&grou... > > I get the impression that Python does not yet support cp720. What happens > if you issue: > > chcp 850 > > in your command prompt before trying the django-admin.py command? That will > change your command prompt's code page to multilingual latin1 and I'd think > you should at least be able to see what django-admin is trying to say. > > Karen > > On 7/13/07, que0x <[EMAIL PROTECTED]> wrote: > > > > > Hi all, > > i get the following errors while trying to run Django-admin.py : > > " > > > Traceback (most recent call last): > > File "C:\\Python25\\Scripts\django-admin.py", line 5, in > > management.execute_from_command_line() > > File "C:\Python25\lib\site-packages\django\core\management.py", line > > 1623, in execute_from_command_lin > > parser.print_usage_and_exit() > > File "C:\Python25\lib\site-packages\django\core\management.py", line > > 1562, in print_usage_and_exit > > self.print_help(sys.stderr) > > File "C:\Python25\lib\optparse.py", line 1648, in print_help > > file.write(self.format_help().encode(encoding, "replace")) > > LookupError: unknown encoding: cp720 > > > " > > > any suggestion will be much appreciated . > > > Thanks, > > Q. --~--~-~--~~~---~--~~ 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: flatpages issues
Yes sir. I followed the examples in the official docs literally and in order (http://www.djangoproject.com/documentation/flatpages/#installation steps 1-3). That worked fine and I was able to immediately start creating flatpages via the admin interface. But I cannot view flatpages on the site. I only added the line to urls.py because I saw some other example somewhere with the catch-all-else pattern but this did seem to at least get me one step closer. Without the urls.py addition, flatpages does not seem to be invoked to handle the 404 at all. Cheers, j-s On 7/13/07, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > > > Hi John-Scott -- > > Did you add ' > django.contrib.flatpages.middleware.FlatpageFallbackMiddleware' > to your ``MIDDLEWARE_CLASSES`` setting? > > Jacob > > > > --~--~-~--~~~---~--~~ 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: html sanitizers
well, but sometimes you want them to be able to enter HTML. style items, simple links, etc... [EMAIL PROTECTED] wrote: > Yes it is much safer to reject rather than sanitize. If bad tags are > detected then reject the input out of hand. If you don't your > sanitizer could be turned against you and end up changing slightly > dangerous tags into really dangerous tags. What happens here > ipt> when a sanitizer is set to remove all of the script > tags? If the user made a genuine mistake then let them fix it. > Otherwise it is a hack attempt and not worth your trouble. > > On Jul 13, 8:08 am, Horst Gutmann <[EMAIL PROTECTED]> wrote: >> The problem with whatever system you use, is the huge amount of ways to >> inject XSS attacks into HTML thanks to problems in the various browser >> engines. A few weeks I found a nice listing (nice long listing) but >> can't remember the URL anymore :-/ >> >> .. _BeautifulSoup:http://www.crummy.com/software/BeautifulSoup/ > > > > > --~--~-~--~~~---~--~~ 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: flatpages issues
Hi John-Scott -- Did you add 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware' to your ``MIDDLEWARE_CLASSES`` setting? Jacob --~--~-~--~~~---~--~~ 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: html sanitizers
Yes it is much safer to reject rather than sanitize. If bad tags are detected then reject the input out of hand. If you don't your sanitizer could be turned against you and end up changing slightly dangerous tags into really dangerous tags. What happens here ipt> when a sanitizer is set to remove all of the script tags? If the user made a genuine mistake then let them fix it. Otherwise it is a hack attempt and not worth your trouble. On Jul 13, 8:08 am, Horst Gutmann <[EMAIL PROTECTED]> wrote: > The problem with whatever system you use, is the huge amount of ways to > inject XSS attacks into HTML thanks to problems in the various browser > engines. A few weeks I found a nice listing (nice long listing) but > can't remember the URL anymore :-/ > > .. _BeautifulSoup:http://www.crummy.com/software/BeautifulSoup/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
flatpages issues
hi gang, I'm trying out the flatpages app but not having a great deal of success. I've followed the instructions at http://www.djangoproject.com/documentation/flatpages/. I've added a directory in my templates folder (templates/flatpages/ default.html) according to the example in the documentation. I used the admin interface to make a dummy page 'about' with a URL value of '/ about/' and my site selected for the page. However, when I try to access the url (mysite.com/about/) I get an error saying that it tried using the url patterns in urls.py but "The current URL, about/, didn't match any of these." (I have DEBUG = True in settings.py). If I add: (r'', include('django.contrib.flatpages.urls')), to the urls.py, then I get an error saying "No FlatPage matches the given query." What am I doing wrong? From the official documentation it seems that I shouldn't have to add anything to urls.py, since that's the whole point: flatpages catches the 404 error for url patterns not found in urls.py then checks if there is a match in the database and render the result or else re-raises the 404. Thanks, j-s --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
form processing
I have a form on one of my pages that has two fields with the same name. When I process the POST in my view I only get one of the values ( the last one ). EXAMPLE: HTML DEBUG POST: VIEW request.POST['version'] the above line is = 35 if both checkboxes are checked any ideas why I don't get a list with (38,35)? --~--~-~--~~~---~--~~ 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: little problem
Jacob: Great! I have played it safe with the getattr construct, figuring that the new object instance _might_ be constructed with an id attribute set to None prior to save(). On Jul 13, 2:46 pm, "Lic. José M. Rodriguez Bacallao" <[EMAIL PROTECTED]> wrote: > thanks, that work more efficient that my way of do it, I was getting the > user from the database to see if the user exist. I like your solution, is > pretty clean and simple. Thanks a lot. > > On 7/13/07, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > > > > > On 7/13/07, JeffH <[EMAIL PROTECTED]> wrote: > > > > if getattr(model_instance, 'id', None) is None: > > > model_instance.created_by = whatever > > > Also take a look at ``hasattr()``: > >http://docs.python.org/lib/built-in-funcs.html#l2h-35 > > > Jacob > > -- > Lic. José M. Rodriguez Bacallao > Cupet > - > Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo > mismo. > > Recuerda: El arca de Noe fue construida por aficionados, el titanic por > profesionales > - --~--~-~--~~~---~--~~ 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: Can Google index Django's pages?
Thanks for this fine answer, Julio! Now nothing is going to hold me back! ;) On Jul 13, 8:22 pm, "Julio Nobrega" <[EMAIL PROTECTED]> wrote: > hi Felix, > > Yes, Google will index your website even if you use Django. The only > stuff that stop Google are the robots.txt, meta tags, and a direct > request. Don't worry, if you can access your website using a browser, > there's at least one link to it somewhere, and you didn't do any of > the three things I mentioned to stop Google, search engines will find > you. > > On 7/13/07, felixhummel <[EMAIL PROTECTED]> wrote: > > > > > Hi! > > > Before I decide to dive into Django, could you please tell me if > > Google can crawl pages created by Django natively? > > I am running an Apache with mod_python. Does this matter? > > Thanks in advance! > > > Felix > > -- > Julio Nobrega -http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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: little problem
thanks, that work more efficient that my way of do it, I was getting the user from the database to see if the user exist. I like your solution, is pretty clean and simple. Thanks a lot. On 7/13/07, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > > > On 7/13/07, JeffH <[EMAIL PROTECTED]> wrote: > > > > if getattr(model_instance, 'id', None) is None: > > model_instance.created_by = whatever > > > > Also take a look at ``hasattr()``: > http://docs.python.org/lib/built-in-funcs.html#l2h-35 > > Jacob > > > > -- Lic. José M. Rodriguez Bacallao Cupet - Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo. Recuerda: El arca de Noe fue construida por aficionados, el titanic por profesionales - --~--~-~--~~~---~--~~ 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: little problem
On 7/13/07, JeffH <[EMAIL PROTECTED]> wrote: > > if getattr(model_instance, 'id', None) is None: > model_instance.created_by = whatever > Also take a look at ``hasattr()``: http://docs.python.org/lib/built-in-funcs.html#l2h-35 Jacob --~--~-~--~~~---~--~~ 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: Can Google index Django's pages?
hi Felix, Yes, Google will index your website even if you use Django. The only stuff that stop Google are the robots.txt, meta tags, and a direct request. Don't worry, if you can access your website using a browser, there's at least one link to it somewhere, and you didn't do any of the three things I mentioned to stop Google, search engines will find you. On 7/13/07, felixhummel <[EMAIL PROTECTED]> wrote: > > Hi! > > Before I decide to dive into Django, could you please tell me if > Google can crawl pages created by Django natively? > I am running an Apache with mod_python. Does this matter? > Thanks in advance! > > Felix > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Can Google index Django's pages?
Hi! Before I decide to dive into Django, could you please tell me if Google can crawl pages created by Django natively? I am running an Apache with mod_python. Does this matter? Thanks in advance! Felix --~--~-~--~~~---~--~~ 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: little problem
this works for me: if getattr(model_instance, 'id', None) is None: model_instance.created_by = whatever On Jul 13, 1:28 pm, "Lic. José M. Rodriguez Bacallao" <[EMAIL PROTECTED]> wrote: > Hi, I got a little problem. I need to store in a model the first user who > created it (created_by) and the user who last modified it > (last_modified_by). So, with the second one, there is no problem, every time > a user save the object, the pre_save signal is dispatched and I catch it so > I can set the "last_modified_by" field to current user but, right there, I > need to set the "created_by" field and I don't know how to do it, my > algorithm is pretty simple: > > if model_instance.created_by is not set: > set model_instance.created_by to current user > . > . > . > continues with save > > the problem here is how to know if model_instance.created_by field is set or > not, I think that it can be known if a can figure out if save method is > going to insert or update, but, how I know it? > > -- > Lic. José M. Rodriguez Bacallao > Cupet > - > Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo > mismo. > > Recuerda: El arca de Noe fue construida por aficionados, el titanic por > profesionales > - --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
little problem
Hi, I got a little problem. I need to store in a model the first user who created it (created_by) and the user who last modified it (last_modified_by). So, with the second one, there is no problem, every time a user save the object, the pre_save signal is dispatched and I catch it so I can set the "last_modified_by" field to current user but, right there, I need to set the "created_by" field and I don't know how to do it, my algorithm is pretty simple: if model_instance.created_by is not set: set model_instance.created_by to current user . . . continues with save the problem here is how to know if model_instance.created_by field is set or not, I think that it can be known if a can figure out if save method is going to insert or update, but, how I know it? -- Lic. José M. Rodriguez Bacallao Cupet - Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo. Recuerda: El arca de Noe fue construida por aficionados, el titanic por profesionales - --~--~-~--~~~---~--~~ 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: Errors in installing Django Trunk version on Windows xp
Looks like you've got a couple of problems. First the traceback seems to indicate that django-admin doesn't like whatever arguments you have passed to it, so it attempts to print out its usage message. However then Python hiccups attempting to convert the message into your command prompt's code page. From this page: http://sourceforge.net/tracker/index.php?func=detail&aid=1616979&group_id=5470&atid=305470 I get the impression that Python does not yet support cp720. What happens if you issue: chcp 850 in your command prompt before trying the django-admin.py command? That will change your command prompt's code page to multilingual latin1 and I'd think you should at least be able to see what django-admin is trying to say. Karen On 7/13/07, que0x <[EMAIL PROTECTED]> wrote: > > > Hi all, > i get the following errors while trying to run Django-admin.py : > " > > Traceback (most recent call last): > File "C:\\Python25\\Scripts\django-admin.py", line 5, in > management.execute_from_command_line() > File "C:\Python25\lib\site-packages\django\core\management.py", line > 1623, in execute_from_command_lin > parser.print_usage_and_exit() > File "C:\Python25\lib\site-packages\django\core\management.py", line > 1562, in print_usage_and_exit > self.print_help(sys.stderr) > File "C:\Python25\lib\optparse.py", line 1648, in print_help > file.write(self.format_help().encode(encoding, "replace")) > LookupError: unknown encoding: cp720 > > > " > > any suggestion will be much appreciated . > > Thanks, > Q. > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Looking for 2 great python/django developers in Atlanta area
Our web development team is looking for experienced Python/Django Web developers. We're a small group practicing agile and rapid development looking to grow bigger. This is not a typical, "hand me a spec and I'll build it" shop. We play an integral role in shaping products, and then building them. We have a vision for a product, work with key stakeholders, and build it. Strong communication and people skills are required. Candidates with a background in journalism/publishing/media, or at least a healthy respect for it, would be great. Further, candidates who have contributed to open-source projects, and/ or have a strong attraction to open-source technologies, are preferred. If your looking for a job with excitement and fast-paced development, look no further. We recently started doing "Google 20% time" and would love to have our developers help contribute back to Django! We also are big fans of telecommuting days and flexible hours. If your interested or know someone who is, please contact me directly: cheisel [at] ajc [dot] com Thanks! Chris H. --~--~-~--~~~---~--~~ 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: django + nginx: upstream split a header line in FastCGI records
Atypically, the moment I petition for help I solve the problem myself. Solution: Use the latest development version b/c Changes with nginx 0.6.2 09 Jul 2007 *) Bugfix: if the FastCGI header was split in records, then nginx passed garbage in the header to a client. nginx is now cooperating well with django sans 'APPEND_SLASH = False', which means my urls are as I would expect them using django's development server. nginx kindly provides the trailing slash, which apache otherwise provides, whereas lighttpd was proving a royal [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Difference between a model's field and it's translated version - admin
If I have the model specified as: class Candy(models.Model): name = models.CharField(_('name'), maxlength=25) The admin section, displays the field as, 'Name', while the translated version will appear as 'onoma', ie, the first letter isn't capitalized. The translated word is specified all lower-case in the .po file. Is it possible to have the admin section, display it with the first letter capitalized when appropriate? Django v0.96, DB: SQLite --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
django + nginx: upstream split a header line in FastCGI records
Does anyone know what this is about? 2007/07/14 00:35:54 [alert] 22564#0: *17 upstream split a header line in FastCGI records while reading response header from upstream, client: 127.0.0.1, server: localhost, URL: "/", upstream: "fastcgi:// unix:/tmp/django1.sock:", host: "localhost", referrer: "http:// localhost/" It has me just about ready to go back to apache. Django is 0.95.1, although I also tried the latest from trunk to now avail. In 'settings.py' APPEND_SLASH = False APPEND_SLASH = True gave me string index out of range as per Ticket #3414, In nginx.conf: location / { fastcgi_pass unix:/tmp/django1.sock; fastcgi_pass_header Authorization; fastcgi_intercept_errors off; fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_param REQUEST_METHOD$request_method; fastcgi_param QUERY_STRING $query_string; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH$content_length; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param SERVER_NAME $server_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param REMOTE_USER $remote_user; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_SOFTWARE "nginx"; fastcgi_param GATEWAY_INTERFACE "CGI/1.1"; fastcgi_param UID_SET $uid_set; fastcgi_param UID_GOT $uid_got; } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
SQL VIEWs as Django Models for aggregation --- delete() issues with django.db.models.query: delete_objects
This post relates to two separate Django issues that intertwined for me: 1. Lack of aggregation support in Django's ORM (I am delighted to see http://groups.google.com/group/django-developers/browse_thread/thread/f433edf7b0ebdbcb/ ) 2. Django does not use delete() methods for related objects (as noted previously in: http://groups.google.com/group/django-users/browse_thread/thread/3e37575e42de86c9/ and http://groups.google.com/group/django-users/browse_thread/thread/2d1dc42cea162c4b/ ) I would like to hear from others how they are dealing with #1 and what their thoughts are about #2. Here goes: Experimenting with ways to add aggregated database information into my Django models, I came across a blog entry several weeks ago where the author (my apologies for not having the reference to cite) said they used VIEWs as Django Models, simply putting in the SQL code to drop the table and create a like-named VIEW in sql/model_name as discussed at http://www.djangoproject.com/documentation/0.96/model-api/#providing-initial-sql-data for providing initial data. I chose to make my VIEW models one-to-one with the actual Django model that uses the aggregation data, so I can say event.event_view.capacity_remaining for instance and the calculation for the number of seats remaining at an event (taking into account reserved tables, etc) is quietly done by the SQL VIEW, the Django query just looks up the result. I added empty delete() and save() methods to the view models to prevent such activities (or so I thought!) on a non-updatable view. This approach, as opposed to coding an aggregation query as a method of a Model, has the advantage of allowing the use of Django's ORM elegance to do things like EventView.objects.filter(whatever__lookup) using one database query rather than doing list comprehensions of method calls and having separate queries for each instance. Here the fun begins: When I tried to delete an inline object in the Django Admin by clearing all the core=True fields, I got an OperationError 1228, VIEW not UPDATEable. Argh! I had just discovered that Django does not use the delete() methods of Models to delete related objects. My fix for this specific problem was to patch django.db.models.query.delete_objects() to see if the related model overrides the delete() method, and if so, use it instead of the existing batch SQL DELETE approach: Starting at line 1059: # Now delete the actual data for cls in ordered_classes: seen_objs[cls].reverse() pk_list = [pk for pk,instance in seen_objs[cls]] # if a related object's class overrides the django.db.models.Model delete method - use it if filter(lambda o: o.__dict__.has_key('delete'),cls.__mro__) [0].__module__ != 'django.db.models.base': map(lambda o: o.delete(), cls._default_manager.filter(pk__in=pk_list)) else: for offset in range(0, len(pk_list), GET_ITERATOR_CHUNK_SIZE): cursor.execute("DELETE FROM %s WHERE %s IN (%s)" % \ (qn(cls._meta.db_table), qn(cls._meta.pk.column), ','.join(['%s' for pk in pk_list[offset:offset +GET_ITERATOR_CHUNK_SIZE]])), pk_list[offset:offset+GET_ITERATOR_CHUNK_SIZE]) It's 4 lines of code - the patch starts with the second comment - plus indenting within my else clause the original code used for the delete. Most likely this patch does not cover cases like ManyToManyFields, etc, I only had time to make the original error go away. Thoughts? Comments? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problems with depth and select_related
I seem to be having a bit of a problem with the depth parameter to select_related. If I have only simple relationships, i.e. only three tables involved linked by a simple foreign key chain it all *seems* to work OK. I get the right data in both model instances with just the one query issued to the database. So if I do Booking.objects.selected_related(depth=1).filter(...) I get all the right data. However, if I have a much more complex set of models with many FK chains to different models I get the *wrong* data in some of the model instances if I use the depth parameter. I.e. I get the title data from the Customer model appearing in the description field in the Activity model! If I omit the select_related it all works as expected, but with lots of queries. If I use select_related, but omit he depth parameter, it all works OK, but I get a much larger query. Does anyone know of any problems with the depth parameter? I'm sorry if this is a bit vague, but it only seems to happen on complex relationships and I haven't been able to get a simple enough standalone case together yet. I'm working on it... Thanks, Gary. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Errors in installing Django Trunk version on Windows xp
Hi all, i get the following errors while trying to run Django-admin.py : " Traceback (most recent call last): File "C:\\Python25\\Scripts\django-admin.py", line 5, in management.execute_from_command_line() File "C:\Python25\lib\site-packages\django\core\management.py", line 1623, in execute_from_command_lin parser.print_usage_and_exit() File "C:\Python25\lib\site-packages\django\core\management.py", line 1562, in print_usage_and_exit self.print_help(sys.stderr) File "C:\Python25\lib\optparse.py", line 1648, in print_help file.write(self.format_help().encode(encoding, "replace")) LookupError: unknown encoding: cp720 " any suggestion will be much appreciated . Thanks, Q. --~--~-~--~~~---~--~~ 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: Avoiding HTTP 301 code using mod_python
On 7/13/07, Chris Hoeppner <[EMAIL PROTECTED]> wrote: > > You might want to have a look at: > > http://www.djangoproject.com/documentation/settings/#append-slash > Well just for the record, I have disabled CommonMiddleware and set APPEND_SLASH to False, both changes didn't work, I still get the same result. I have opened a ticket with webfaction.com, pointing this thread and a topic on their forums describing the same problem, let's wait. Thanks for the replies Miguel --~--~-~--~~~---~--~~ 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: select_related(), m2m, foreign(null=True)
Sorry, here's the example. Or is there any simpler way to achieve the same thing? JJ. class Book(models.Model): title = ... main_author = ForeignKey(Author, null=True) co_authors = ManyToManyField(Author) class Reprint(models.Model): book = ForeignKey(Book) class BooksManager(models.Manager): def select_related_ex(self, query=None): books = query.select_related() main_authors = self.main_authors_in_bulk() co_authors = self.main_authors_in_bulk() reprints = self.reprints_in__bulk() for book in books: book.cached_main_author = main_authors.get(book.id, None) book.cached_co_authors = co_authors.get(book.id, None) book.cached_reprints = reprints.get(book.id, None) def main_authors_in_bulk(self): query = """ SELECT book_book.id, book_main_author.first_name, book_main_author.last_name FROM book_book, book_main_author WHERE book_book.book_id = book_main_author.initials """ cursor = db.connection.cursor() cursor.execute(query) values = {} for id, first_name, last_name in cursor.fetchall(): values[id] = mymodel.Author(first_name=first_name, last_name=last_name) return values def co_authors_in_bulk(self): query = """ SELECT book_book_co_authors.book_id, book_author.initials, book_author.first_name, book_author.last_name FROM book_book_co_authors, book_author WHERE book_book_co_authors.author_id = book_author.initials ORDER BY book_author.initials ASC """ cursor = db.connection.cursor() cursor.execute(query) values = {} for id, first_name, last_name in cursor.fetchall(): ids = values.get(id, []) ids.append(mymodel.Author(first_name=first_name, last_name=last_name)) values[id] = ids return values def reprints_in_bulk(): ... On Jul 13, 12:26 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Fri, 2007-07-13 at 09:57 +, jj wrote: > > I posted earlier about performance issues trying to display many books > > in one single page. I've since fixed the problems by reducing the > > number of SQL queries from 12 per book, to just 11 overall. I also > > perform filtering based on user's permissions up-front. Big > > performance boost. > > > I ended writing several managers. Typing almost the same code in each > > manager. Encapsulating it all in a hand-crafted select_related_ex() > > that also fetches ManyToManyField's and ForeignKey's where > > "null=True". > > > It occurred to me that such code could/should probably be made generic > > and part of the standard Django distribution. > > You haven't included an example of what you're talking about, so it's > difficult to comment on the specifics. > > Malcolm > > -- > Telepath required. You know where to apply...http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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: Using Django without database
I've done a lot of applications with this kind of concern. But it really doesn't change the design much. The web server goes on one side of the DMZ and the database server goes on the other. That probably should be the standard anyway, keep as little extraneous data as possible on the web server. Works very well and is about as secure as you are going to get. If "they" can crack your database, I would bet "they" will be able to crack your web service. On 7/12/07, Patrick <[EMAIL PROTECTED]> wrote: > > > Unfortunately, I can't give you more details about the security aspect, > except that it has to do with prolonged physical storage of large amounts > of data online, which is "insecure". The exact details are not known to > me yet. I'm a developer that has been told to make a web app instead of a > desktop program that works with a pretty old system :) > > I know it sounds a bit contradictory, but at this point I'm exploring > possibilities. It might be that a database would be the best option in > the end. It would be so much easier. > > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Getting debug with apache and mod_python
With apache and mod_python, and this configuration: SetHandler python-program PythonHandler django.core.handlers.modpython PythonPath "['/home/django/django_projects/'] + sys.path" SetEnv DJANGO_SETTINGS_MODULE legacoopfc.settings_corrierecooperativo PythonDebug On I cannot see 500 errors trackback. On settings I have DEBUG=True, and apache error.log says only: [Fri Jul 13 14:20:10 2007] [notice] mod_python: (Re)importing module 'django.core.handlers.modpython' Any helps? -- Alessandro Ronchi Skype: aronchi http://www.alessandroronchi.net - Il mio sito personale http://www.soasi.com - Sviluppo Software e Sistemi Open Source --~--~-~--~~~---~--~~ 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: html sanitizers
Brett Parker wrote: > On Fri, Jul 13, 2007 at 11:48:50AM +0100, Nic James Ferrier wrote: >> Brett Parker <[EMAIL PROTECTED]> writes: >> >>> On Fri, Jul 13, 2007 at 11:18:18AM +0100, Nic James Ferrier wrote: Derek Anderson <[EMAIL PROTECTED]> writes: > hey all, > > could anyone point me to a python html sanitizer implementation (or > example)? i don't mean to strip all html, just tags and attributes not > on a whitelist, such as I/B/A href/U/etc. I use libxml2/libxslt, something like: doc = libxml2.htmlParseDoc(whatever, "utf8") result = libxslt.applyStylesheetFile(doc, "strip.xslt", {}) There are loads of ways of stripping in xslt depending on what you want to do. >>> Only works on well formed XHTML documents though... which although they >>> should be the norm, really aren't! >> No. In my example I deliberately used libxml2' HTML parser which is an >> HTML parser not an XHTML parser. >> >> It copes with non-well formed documents as well as all the usual >> entity problems. > > Ohhh, so you did - sorry - eyes still blurry from sleep deprivation! > > Cheers, I used BeautifulSoup_ for this job which is also a generic HTML parser and provides some easy ways to remove certain HTML elements from the tree while keeping some in. The problem with whatever system you use, is the huge amount of ways to inject XSS attacks into HTML thanks to problems in the various browser engines. A few weeks I found a nice listing (nice long listing) but can't remember the URL anymore :-/ .. _BeautifulSoup: http://www.crummy.com/software/BeautifulSoup/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
WeSearchit4u.com- new Search Assistance Service- Anyone tested it?
Dear Friends. I would like to introduce a new search assistance service www.wesearchit4u.com. It is similar to Google Answers and Yahoo Answers, but a lot more professional. They call themselves search assistants and seem to search complicated information on the web for users of this site. It will help you to reduce your time searching the internet for articles, links or any other information. It only costs US$ 30 per query. If you cannot find the information yourself or do not have the time, you can post your search query on this website and they will try to find the required information for you. It seems to be available the next day. It certainly looks a lot more professional than the other Q & A Sites around, although they don't want to call themselves such a site. For now the service is free, so lets try them out before we have to pay. And once they go payable, they ask for credit card pre authorization only and you only pay when you are satisfied. This looks to me a lot more reliable than all the other sites, asking for payment for their services in advance, before they even do anything. The url is : http://www.wesearchit4u.com Take Care --~--~-~--~~~---~--~~ 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: html sanitizers
On Fri, Jul 13, 2007 at 11:48:50AM +0100, Nic James Ferrier wrote: > > Brett Parker <[EMAIL PROTECTED]> writes: > > > On Fri, Jul 13, 2007 at 11:18:18AM +0100, Nic James Ferrier wrote: > >> > >> Derek Anderson <[EMAIL PROTECTED]> writes: > >> > >> > hey all, > >> > > >> > could anyone point me to a python html sanitizer implementation (or > >> > example)? i don't mean to strip all html, just tags and attributes not > >> > on a whitelist, such as I/B/A href/U/etc. > >> > >> I use libxml2/libxslt, something like: > >> > >> doc = libxml2.htmlParseDoc(whatever, "utf8") > >> result = libxslt.applyStylesheetFile(doc, "strip.xslt", {}) > >> > >> There are loads of ways of stripping in xslt depending on what you > >> want to do. > > > > Only works on well formed XHTML documents though... which although they > > should be the norm, really aren't! > > No. In my example I deliberately used libxml2' HTML parser which is an > HTML parser not an XHTML parser. > > It copes with non-well formed documents as well as all the usual > entity problems. Ohhh, so you did - sorry - eyes still blurry from sleep deprivation! Cheers, -- Brett Parker --~--~-~--~~~---~--~~ 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: html sanitizers
Brett Parker <[EMAIL PROTECTED]> writes: > On Fri, Jul 13, 2007 at 11:18:18AM +0100, Nic James Ferrier wrote: >> >> Derek Anderson <[EMAIL PROTECTED]> writes: >> >> > hey all, >> > >> > could anyone point me to a python html sanitizer implementation (or >> > example)? i don't mean to strip all html, just tags and attributes not >> > on a whitelist, such as I/B/A href/U/etc. >> >> I use libxml2/libxslt, something like: >> >> doc = libxml2.htmlParseDoc(whatever, "utf8") >> result = libxslt.applyStylesheetFile(doc, "strip.xslt", {}) >> >> There are loads of ways of stripping in xslt depending on what you >> want to do. > > Only works on well formed XHTML documents though... which although they > should be the norm, really aren't! No. In my example I deliberately used libxml2' HTML parser which is an HTML parser not an XHTML parser. It copes with non-well formed documents as well as all the usual entity problems. -- Nic Ferrier http://www.tapsellferrier.co.uk --~--~-~--~~~---~--~~ 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: installation issues
On 13-jul-2007, at 5:42, surfwizz wrote: > I installed python from www.python.org, so the command prompt opens it > into 2.5.1. That's what I tried to install django into. Can you confirm that django is installed at this location? /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- packages/django/ (try 'locate django' in the Terminal to find out where all of django is) > [...] so I just ran setup.py in IDLE as a module. Is there a way > to fix this, or get this install running properly? What do you mean 'in IDLE as a module'? AFAIK the correct way to install python packages is to run 'sudo python setup.py' from the normal command line. Or did you do that? best dirk --~--~-~--~~~---~--~~ 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: IN query fails (when params not used)
On Fri, 2007-07-13 at 10:07 +, jj wrote: > Why does the 1st query fail, whilst the 2nd succeeds, although the SQL > is identical? > > The 1st query indeed returns the error: "OperationalError: no such > column: 'FR'". Because you're not quoting the strings correctly. You need to wrap them in single quotes to be valid SQL. This is one of the strong reasons why the second approach is better: the DB-API wrappers know how to get the quoting correct. The slightly painful bit is the usual problem of having to put in enough placeholders for the number of parameters you have to go into the IN-clause. Regards, Malcolm -- The only substitute for good manners is fast reflexes. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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: select_related(), m2m, foreign(null=True)
On Fri, 2007-07-13 at 09:57 +, jj wrote: > I posted earlier about performance issues trying to display many books > in one single page. I've since fixed the problems by reducing the > number of SQL queries from 12 per book, to just 11 overall. I also > perform filtering based on user's permissions up-front. Big > performance boost. > > I ended writing several managers. Typing almost the same code in each > manager. Encapsulating it all in a hand-crafted select_related_ex() > that also fetches ManyToManyField's and ForeignKey's where > "null=True". > > It occurred to me that such code could/should probably be made generic > and part of the standard Django distribution. You haven't included an example of what you're talking about, so it's difficult to comment on the specifics. Malcolm -- Telepath required. You know where to apply... http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ 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: html sanitizers
On Fri, Jul 13, 2007 at 11:18:18AM +0100, Nic James Ferrier wrote: > > Derek Anderson <[EMAIL PROTECTED]> writes: > > > hey all, > > > > could anyone point me to a python html sanitizer implementation (or > > example)? i don't mean to strip all html, just tags and attributes not > > on a whitelist, such as I/B/A href/U/etc. > > I use libxml2/libxslt, something like: > > doc = libxml2.htmlParseDoc(whatever, "utf8") > result = libxslt.applyStylesheetFile(doc, "strip.xslt", {}) > > There are loads of ways of stripping in xslt depending on what you > want to do. Only works on well formed XHTML documents though... which although they should be the norm, really aren't! I tend to use the sanitizer from feedparser. from feedparser import _HTMLSanitizer as HTMLSanitizer sanitizer = HTMLSanitizer('utf8') sanitizer.feed(content) output = sanitizer.output() Cheers, -- Brett Parker --~--~-~--~~~---~--~~ 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: html sanitizers
Derek Anderson <[EMAIL PROTECTED]> writes: > hey all, > > could anyone point me to a python html sanitizer implementation (or > example)? i don't mean to strip all html, just tags and attributes not > on a whitelist, such as I/B/A href/U/etc. I use libxml2/libxslt, something like: doc = libxml2.htmlParseDoc(whatever, "utf8") result = libxslt.applyStylesheetFile(doc, "strip.xslt", {}) There are loads of ways of stripping in xslt depending on what you want to do. -- Nic Ferrier http://www.tapsellferrier.co.uk --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
IN query fails (when params not used)
Why does the 1st query fail, whilst the 2nd succeeds, although the SQL is identical? The 1st query indeed returns the error: "OperationalError: no such column: 'FR'". query = """ SELECT book_foreign_print.book_id, book_foreign_print.date, book_foreign_print.country_id FROM book_foreign_print, book_country WHERE book_foreign_print.country_id = book_country.name %s """ % ( countries and 'AND book_foreign_print.country_id IN (%s)' % countries or '' ) cursor.execute(query) where countries='FR,GB', and: query = """ SELECT book_foreign_print.book_id, book_foreign_print.date, book_foreign_print.country_id FROM book_foreign_print, book_country WHERE book_foreign_print.country_id = book_country.name %s """ % ( countries and 'AND book_foreign_print.country_id IN (%s)' % ','.join(['%s'] * len(countries)) or '' ) cursor.execute(query, countries) where countries=['FR', 'GB'] --~--~-~--~~~---~--~~ 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: html sanitizers
it´s easy to write a customized sanitizer using beautifulsoup. http://www.crummy.com/software/BeautifulSoup/ 1) place beautifulsoup.py somewhere in your pythonpath 2) build your sanitizer and save it somewhere on your pythonpath in my case it´s called eatMe and looks like this: http://dpaste.com/hold/14305/ your sanitizer will probably be less complicated ... 3) in your models.py, do something like this: def isGoodHTML(field_data, all_data): from eatMe import doEatMe if field_data: new_field_data = doEatMe(field_data) if new_field_data != all_data['summary']: all_data['summary'] = new_field_data raise validators.ValidationError, "The errors in your document were automatically corrected. Please check again!" isGoodHTML.always_test = True ... summary = models.TextField(validator_list=[isGoodHTML]) note: I know this looks complicated, but if you built your sanitizer once you can always reconfigure and reuse it. we use the above example for text-fields in the admin (with TinyMCE). patrick Am 13.07.2007 um 11:23 schrieb Derek Anderson: > > hey all, > > could anyone point me to a python html sanitizer implementation (or > example)? i don't mean to strip all html, just tags and attributes > not > on a whitelist, such as I/B/A href/U/etc. > > danke, > derek > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
select_related(), m2m, foreign(null=True)
I posted earlier about performance issues trying to display many books in one single page. I've since fixed the problems by reducing the number of SQL queries from 12 per book, to just 11 overall. I also perform filtering based on user's permissions up-front. Big performance boost. I ended writing several managers. Typing almost the same code in each manager. Encapsulating it all in a hand-crafted select_related_ex() that also fetches ManyToManyField's and ForeignKey's where "null=True". It occurred to me that such code could/should probably be made generic and part of the standard Django distribution. Has any thoughts already been dedicated to this? Is it only a question of time/priorities that it has not been included upfront? JJ. --~--~-~--~~~---~--~~ 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: Missing Plus-Sign over ManyToManyField
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Yes, of course... THANKS!!! > > You need to add the Admin class to ContactPerson > > -rob > > On Jul 12, 6:59 am, Manuel Meyer <[EMAIL PROTECTED]> wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA256 >> >> Hey, >> >> from other projects, running on the same django instance, I know that >> there is a possibility to display a '+' icon located over the >> ManyToManyField, that allows u to add a new object to relate to. >> So - in my case - you could add a contact person while adding a >> project. But the sign doesnt appear. Any idea why? >> >> Thanks, Manuel >> >> from django.db import models >> from django.utils.translation import gettext_lazy as _ >> # Create your models here. >> >> class ContactPerson(models.Model): >> name = models.CharField(_("Full Name"), maxlength=255, >> core=True) >> email = models.EmailField(_("Email"), null =True, blank = True) >> phone = models.CharField(_("Phone"), maxlength=30, null =True, >> blank = True) >> >> class Project(models.Model): >> verbose_name = models.CharField(_("Full Name"), maxlength=255, >> core=True) >> short_name = models.SlugField(_("Slug Name"), prepopulate_from= >> ("verbose_name",), unique=True, help_text=_("This is a short, >> descriptive name of the shirt that will be used in the URL link to >> this item")) >> text = models.TextField(_("Describing text"), help_text=_("A >> short description")) >> dateStart = models.DateField(_("Start Date"), null =True, blank >> = True) >> timeStart = models.TimeField(_("Start Time"), null =True, blank >> = True) >> contact_person = models.ManyToManyField(ContactPerson, >> filter_interface=True) >> >> class Admin: >> pass >> -BEGIN PGP SIGNATURE- >> Version: GnuPG v1.4.6 (Darwin) >> >> iQEVAwUBRpYztDOKNHIOcnYMAQieQQf/eTuVUJyGuAMmSoykj3sWGZQSrzBT44PQ >> eRp/zrjwKuoDkXoxxw4EXcisa/Dupdi7VX2WF1iBgjCYkS8RNLXHBV8vIzaWX7kU >> THbAgXsxzeKfw99XfMojijoUaMGbjVIkHnZDRr/jbdJ3ftzuWxBGVnJBa5uTee2k >> nlhVa6ABVcednZyRGos5LB3vJgSAzGqRfzj0MpFXY6Id2yMuwIDDrVAqLlxqleOA >> tz9kVlKqiKg3mwD3arzStx8jPKmoSDKi4gNFzBd0kSVItW8hKYq1BOCmWxh/3oM2 >> HpgWTE8jHwSRUrVyIQkTlijyiu2yYxgrtGePDxjKDFD9ZLE59m7wRQ== >> =Zuh+ >> -END PGP SIGNATURE- > > > > -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (Darwin) iQEVAwUBRpdLLDOKNHIOcnYMAQiJeQf8Clm5dMt7fuct+iNOM0PCgeSVLN8A/FtE XxsaNg/wVlkixE15siik+SbwwWuemX4Kd/9S8913Y1y4TFxJiqgnVMrtNPVwyCHt 2+RRBClRGPBT0cYZi7VtcBp2woxIwDbLFGuj73e820as7Luh9tnPBzta8gZhwSd+ oMeORA4aHKxUcXxrH6f8IgNTZOGqr1xWA4qEJnOva2fvKkIinQqydivdJHuq/O9W whg+cmTP6Iq3Ofp1Qm3N2LUNldpZ+yoE2+7/Q9c8GMlgRY1aoioNOxI/ijDDoBte vI3xANoCbeXu7j4ZZubLz2PWIsP6jhxmD2NrT3yzHnLZCy18XoSwUA== =DGIT -END PGP SIGNATURE- --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
RequestContext, user, cannot resolve keyword error
I often get this error with the built-in server: Exception Type: TypeError Exception Value: Cannot resolve keyword 'user' into field Exception Location: C:\Python25\lib\site-packages\django\db\models \query.py in lookup_inner, line 939 (I query the RequestContext to obtain the logged-in user.) Not a big issue, but annoying after a while. A restart of the server is enough. JJ. --~--~-~--~~~---~--~~ 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: Generating graphs from db data and displaying results using Django?
Toby Dylan Hocking <[EMAIL PROTECTED]> writes: > TimeSeries, etc. similar to XML/SWF Charts), but you can pop in your own > plotting code and have a totally custom plot too, if you need to. Such flexibility is great. I suggest to support "common" tasks too by providing an additional "simple" interface (if it is not already there, I didn't have a look at your package yet). Something like Tex and LaTeX, the one for total control, the other for common tasks. 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: get_FOO_url() returns empty string
Collin Grady schrieb: > You're missing the trailing slash on MEDIA_URL though, so get_img_url > won't get the proper path. Collin, that was my second fault, which came up after correcting my program as Jonathan described. Thank you, Wolf --~--~-~--~~~---~--~~ 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: get_FOO_url() returns empty string
Jonathan Buchanan schrieb: > wolfds wrote: > > I ran into a problem which I tried to solve for several hours now. The > > situation is simple and straightforward: > > > > models.py: > > > > class Foo(models.Model) > > img = model.ImageField(upload_to='pix') > > > > settings.py: > > > > MEDIA_ROOT = '/home/wolf/appl/media/' > > MEDIA_URL = 'http://my.host.de/media' > > > > foo.html: > > > > > > > > The result is an empty image frame, because get_img_url returns an > > empty string. If I change foo.html like this > > > > http://my.host.de/media/{{ foo.img }}"> > > or even > > > > > > the image appears. BTW, upload from admin works fine. The environment > > is apache2 with mod_python. Normally I use the latest revision from > > unicode branch (5677). For testing purposes I've installed the latest > > trunk revision (also 5677) with the same result. Is this possibly a > > unicode problem? Before I came back to the django ImageField I tried > > ImageWithThumbnailField from the nesh package, which reported an error > > that arguments to thumbnail from my html have to be string, not > > unicode. > > > > TIA for your help. > > > > Wolf > > {{ foo.get_img_url }} > > Regards, > Jonathan. Thank you Jonathan, my fault was so obvious. It hurts. I used a telescope to look for a solution just in front of me. Regards, Wolf --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
html sanitizers
hey all, could anyone point me to a python html sanitizer implementation (or example)? i don't mean to strip all html, just tags and attributes not on a whitelist, such as I/B/A href/U/etc. danke, derek --~--~-~--~~~---~--~~ 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: Avoiding HTTP 301 code using mod_python
You might want to have a look at: http://www.djangoproject.com/documentation/settings/#append-slash Kind regards, Chris Hoeppner www.pixware.org Miguel Filho escribió: > Hello list, > > I'm deploying my site on webfaction.com using mod_python. URL: > http://interno.homelinux.org > > In webfaction.com, I have my Apache instance with mod_python, > listening on a high port, then the main Apache running on the server, > redirect the requests to my Apache instance. A common setup, AFAIK. > > When I try to access an internal URL, like > http://interno.homelinux.org/links, if there is no / at the end, > Django returns an HTTP 301 header, containing the same path, but with > a / at the end. If I type the URL with the / at the end, Django > returns an HTTP 200. Both using mod_python or the `python manage.py > runserver`. > > The problem is when returning the HTTP 301 headers, Django puts in the > response the host with my high port. > > So if I type: > http://interno.homelinux.org/links <-- returns an HTTP 301, headers at > the end of the message. > > Then I get: > http://interno.homelinux.org:2826/links/ > > Using: > http://interno.homelinux.org/links/ <-- slash added, returns an HTTP 200. > > To avoid this, I tried adjusting the URL mapping to this: > (r'^links(/)?', include('interno.links.urls')) > > Adding the (/)? solves the problem, but only if I run my site using > `python manage.py runserver`. If I use mod_python, this does not work, > and Django returns a 301 anyway. > > I tested with Apache2/mod_python in my machine using Debian Lenny, I > have the same behavior as webfaction.com > > Is there anyway to avoid this? I don't understand why the URL mapping > work with the WSGI server, avoiding the 301 responses, but with > mod_python doesn't. > > For logic reasons, I don't want my users accessing my site with a non > standard port. > > Miguel > > Headers: > > GET /links HTTP/1.1 > > Host: interno.homelinux.org > > User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) > Gecko/20070310 Iceweasel/2.0.0.3 (Debian-2.0.0.3-1) > > Accept: > text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 > > Accept-Language: en-us,en;q=0.5 > > Accept-Encoding: gzip,deflate > > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 > > Keep-Alive: 300 > > Connection: keep-alive > > > > HTTP/1.x 301 Moved Permanently > > Date: Thu, 12 Jul 2007 17:49:58 GMT > > Server: Apache/2.0.52 (Red Hat) mod_python/3.3.1 Python/2.5 > > Location: http://interno.homelinux.org:2826/links/ < > > Content-Type: text/html; charset=iso-8859-1 > > Vary: Accept-Encoding,User-Agent > > Content-Encoding: gzip > > Content-Length: 208 > > > > -- > > http://interno.homelinux.org/links/ > > > > GET /links/ HTTP/1.1 > > Host: interno.homelinux.org:2826 > > User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) > Gecko/20070310 Iceweasel/2.0.0.3 (Debian-2.0.0.3-1) > > Accept: > text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 > > Accept-Language: en-us,en;q=0.5 > > Accept-Encoding: gzip,deflate > > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 > > Keep-Alive: 300 > > Connection: keep-alive > > > > > HTTP/1.x 200 OK > > Date: Thu, 12 Jul 2007 17:49:58 GMT > > Server: Apache/2.0.52 (Red Hat) mod_python/3.3.1 Python/2.5 > > Vary: Cookie > > Keep-Alive: timeout=15, max=100 > > Connection: Keep-Alive > > Transfer-Encoding: chunked > > Content-Type: text/html; charset=utf-8 > > > --~--~-~--~~~---~--~~ 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: Django + newforms + jQuery
Przemek Gawronski wrote: > I want to show to the user a list of workorders with the possibility > to select one (probably I should use a radio button for that), above > the list are a couple of buttons that allow to display some extra > information for the selected workorder like a list of time sheets that > this workorder consists of (with the possibility to add/modify/delete > them) the same for printouts and so on. > > One other question is on how do I pass the information about the > selected workorder to the other views that display the time sheet for > example. > > This in general will be a kind off an idiom for my application. I'm assuming that you want to use some form a AJAX type request/response for this? As an outline you might want to do something like this: Display your list as a table Use your workorder id as the html row id of each row in the table Set each of your buttons that do different action to a css class (say "delbtn" for delete buttons etc. Use JQuery to attach a click handler function to each button class, one call per class. In the click handler function, find out which row is selected and get it's id. From then on you can use the JQuery ajax function to perform whatever actions you like using that id (using GET or POST actions perhaps) and getting back json, xml or html to display on the page. From the server side you can get Django to respond in the appropriate way to the urls called from the jQuery ajax function. There are no doubt may other ways that this can be done, but it will hopefully give you a path to investigate. Regards, Gary. --~--~-~--~~~---~--~~ 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: Django + newforms + jQuery
> I have no idea what you're trying to do with your form, How about something like this: in my model I've got a class Workorder, with some info about it. For the Workorder there are time sheets, printouts and some other objects. I want to show to the user a list of workorders with the possibility to select one (probably I should use a radio button for that), above the list are a couple of buttons that allow to display some extra information for the selected workorder like a list of time sheets that this workorder consists of (with the possibility to add/modify/delete them) the same for printouts and so on. One other question is on how do I pass the information about the selected workorder to the other views that display the time sheet for example. This in general will be a kind off an idiom for my application. Przemek -- AIKIDO TANREN DOJO - Poland - Warsaw - Mokotow - Ursynow - Natolin info:http://www.tanren.pl/phone:+4850151 email: [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
confused about the order of the CacheMiddleware in MIDDLEWARE_CLASSES
Hi, all: I touch django not long before, and am learning it, when i touch the CacheMiddleware, i am confused confused about the order of the CacheMiddleware in MIDDLEWARE_CLASSES It is say: "Put the CacheMiddleware after any middlewares that might add something to the Vary header. " in the documentation(http:// www.djangoproject.com/documentation/0.96/cache/) because SessionMiddleware and GZipMiddleware add Vary header, so, i code below in my settings.py: MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.middleware.cache.CacheMiddleware', ) but it doesn't work well, I use "request.COOKIES.get('sessionid','null') " show the sessionid on page, but it show the same value on different browser(the real session id is not that showd on page), it seem it should save differrnt version cache based vary header, In browser the vary header is Cookie I see the codes below in file django/core/handlers/base.py (svn version) 47th line: self._response_middleware.insert(0, mw_instance.process_response) Is it means from bottom from top middleware in MIDDLEWARE_CLASSES when process the response? so i guess that the CacheMiddleware should put before the SessionMiddleware, because the SessionMiddleware add cookie vary header, so the CacheMiddleware can get the vary header added by the SessionMiddleware in response object, but , i not sure,. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---