Re: [Django] #11950: MySQL - Handling illegal mix of collations

2009-09-26 Thread Django
#11950: MySQL - Handling illegal mix of collations
+---
  Reporter:  ekarulf| Owner:  nobody
Status:  closed | Milestone:
 Component:  Uncategorized  |   Version:  1.1   
Resolution:  invalid|  Keywords:
 Stage:  Unreviewed | Has_patch:  0 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by kmtracey):

  * status:  new => closed
  * resolution:  => invalid

Comment:

 There are a couple of ways you could avoid this problem.  First, you could
 use a utf-8 encoding for the table on MySQL.  Since Django always uses
 utf-8 to talk to the database you will then never run into trouble with
 illegal mixtures of collations.  Alternatively, if you want to keep the
 table using latin1 encoding, you can ensure that any parameters you pass
 can be encoded in latin1.  (Do not actually pass latin-1 encoded
 bytestrings, just verify that what you are sending can in fact be encoded
 in latin1.) So far as I've been able to determine, this illegal mix of
 collations error only crops up when you send data that cannot be encoded
 in the table's charset.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #11950: MySQL - Handling illegal mix of collations

2009-09-26 Thread Django
#11950: MySQL - Handling illegal mix of collations
+---
  Reporter:  ekarulf| Owner:  nobody
Status:  new| Milestone:
 Component:  Uncategorized  |   Version:  1.1   
Resolution: |  Keywords:
 Stage:  Unreviewed | Has_patch:  0 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Comment (by ekarulf):

 Sorry for the incomplete report, I pressed submit instead of preview. :)

 I realize this is just a bot probing for SQL injections, but I can't think
 of a good way to catch this bug short of try/catching a MySQLdb
 `OperationalError`.

 I'm not sure exactly what the correct solution is, but it seems like it
 would break the django's db abstraction to coerce data into the same
 collation at the application level.

 {{{
 Python 2.6.2
 FreeBSD: 7.0
 MySQL server: 5.1.22
 MySQL client: 5.1.36
 Django: 1.1
 MySQLdb: 1.2.2
 }}}

 worksforme is an acceptable resolution, there was just not a ticket I
 could find on the matter.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #11950: MySQL - Handling illegal mix of collations

2009-09-26 Thread Django
#11950: MySQL - Handling illegal mix of collations
+---
  Reporter:  ekarulf| Owner:  nobody
Status:  new| Milestone:
 Component:  Uncategorized  |   Version:  1.1   
Resolution: |  Keywords:
 Stage:  Unreviewed | Has_patch:  0 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by Alex):

  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 You've provided absolutely no information as to what we need to do to
 reproduce this, or what might have caused this error.  Django is working
 just fine on MySQL  for quite a lot of people so we're going to need a
 good bit more information to look into this.  If no additional information
 is provided this will be closed as worksforme.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Django] #11950: MySQL - Handling illegal mix of collations

2009-09-26 Thread Django
#11950: MySQL - Handling illegal mix of collations
---+
 Reporter:  ekarulf|   Owner:  nobody
   Status:  new|   Milestone:
Component:  Uncategorized  | Version:  1.1   
 Keywords: |   Stage:  Unreviewed
Has_patch:  0  |  
---+
 Hi All,

 {{{
 Traceback (most recent call last):

  File "/www/www.penny-
 arcade.com/parts/django/django/core/handlers/base.py", line 92, in
 get_response
response = callback(request, *callback_args, **callback_kwargs)

  File "/www/www.penny-
 arcade.com/parts/django/django/views/decorators/cache.py", line 30, in
 _cache_controlled
response = viewfunc(request, *args, **kw)

  File "/www/www.penny-arcade.com/src/penny_arcade/views.py", line 190, in
 archive
if len(tags) == 0:

  File "/www/www.penny-arcade.com/parts/django/django/db/models/query.py",
 line 81, in __len__
self._result_cache = list(self.iterator())

  File "/www/www.penny-arcade.com/parts/django/django/db/models/query.py",
 line 238, in iterator
for row in self.query.results_iter():

  File "/www/www.penny-
 arcade.com/parts/django/django/db/models/sql/query.py", line 287, in
 results_iter
for rows in self.execute_sql(MULTI):

  File "/www/www.penny-
 arcade.com/parts/django/django/db/models/sql/query.py", line 2369, in
 execute_sql
cursor.execute(sql, params)

  File "/www/www.penny-
 arcade.com/parts/django/django/db/backends/mysql/base.py", line 84, in
 execute
return self.cursor.execute(query, args)

  File "/usr/local/lib/python2.6/site-packages/MySQLdb/cursors.py", line
 166, in execute
self.errorhandler(self, exc, value)

  File "/usr/local/lib/python2.6/site-packages/MySQLdb/connections.py",
 line 35, in defaulterrorhandler
raise errorclass, errorvalue

 OperationalError: (1270, "Illegal mix of collations
 (latin1_swedish_ci,IMPLICIT), (utf8_general_ci,COERCIBLE),
 (utf8_general_ci,COERCIBLE) for operation ' IN '")


 http://www.diakonia-
 jkt.sch.id/upload/id1???']}>,
 POST:,
 COOKIES:{},
 META:{'DOCUMENT_ROOT': '/www/www.penny-arcade.com/public/',
  'GATEWAY_INTERFACE': 'CGI/1.1',
  'HTTP_HOST': 'www.penny-arcade.com',
  'HTTP_USER_AGENT': 'Mozilla/5.0',
  'HTTP_X_FORWARDED_FOR': '206.225.23.4',
  'HTTP_X_VARNISH': '499193426',
  'PATH': '/sbin:/bin:/usr/sbin:/usr/bin',
  'PATH_INFO': u'/archive/',
  'PATH_TRANSLATED': '/www/www.penny-arcade.com/bin/django.wsgi/archive/',
  'QUERY_STRING': 'q=news%20%20/path%A7to%A7qnews/q-news.php?id=http://www
 .diakonia-jkt.sch.id/upload/id1???',
  'REMOTE_ADDR': '172.17.16.98',
  'REMOTE_PORT': '52485',
  'REQUEST_METHOD': 'GET',
  'REQUEST_URI':
 '/archive/?q=news%20%20/path%A7to%A7qnews/q-news.php?id=http://www
 .diakonia-jkt.sch.id/upload/id1???',
  'SCRIPT_FILENAME': '/www/www.penny-arcade.com/bin/django.wsgi',
  'SCRIPT_NAME': u'',
  'SERVER_ADDR': '172.17.17.9',
  'SERVER_ADMIN': 'webmas...@penny-arcade.com',
  'SERVER_NAME': 'www.penny-arcade.com',
  'SERVER_PORT': '80',
  'SERVER_PROTOCOL': 'HTTP/1.1',
  'SERVER_SIGNATURE': '',
  'SERVER_SOFTWARE': 'Apache',
  'mod_wsgi.application_group': 'www.penny-arcade.com|',
  'mod_wsgi.callable_object': 'application',
  'mod_wsgi.listener_host': '',
  'mod_wsgi.listener_port': '80',
  'mod_wsgi.process_group': '',
  'mod_wsgi.reload_mechanism': '0',
  'mod_wsgi.script_reloading': '1',
  'mod_wsgi.version': (2, 5),
  'wsgi.errors': ,
  'wsgi.file_wrapper': ,
  'wsgi.input': ,
  'wsgi.multiprocess': True,
  'wsgi.multithread': False,
  'wsgi.run_once': False,
  'wsgi.url_scheme': 'http',
  'wsgi.version': (1, 0)}>
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Changeset] r11594 - in django/trunk: django/views/decorators tests/regressiontests/decorators

2009-09-26 Thread noreply

Author: lukeplant
Date: 2009-09-26 14:39:42 -0500 (Sat, 26 Sep 2009)
New Revision: 11594

Modified:
   django/trunk/django/views/decorators/cache.py
   django/trunk/tests/regressiontests/decorators/tests.py
Log:
Corrected regressions introduced in r11586 and r11593

I read the order of arguments in the docs incorrectly, doh!


Modified: django/trunk/django/views/decorators/cache.py
===
--- django/trunk/django/views/decorators/cache.py   2009-09-23 23:47:53 UTC 
(rev 11593)
+++ django/trunk/django/views/decorators/cache.py   2009-09-26 19:39:42 UTC 
(rev 11594)
@@ -23,20 +23,24 @@
 def cache_page(*args):
 # We need backwards compatibility with code which spells it this way:
 #   def my_view(): pass
-#   my_view = cache_page(123, my_view)
+#   my_view = cache_page(my_view, 123)
 # and this way:
 #   my_view = cache_page(123)(my_view)
+# and possibly this way (?):
+#   my_view = cache_page(123, my_view)
 
 # We also add some asserts to give better error messages in case people are
 # using other ways to call cache_page that no longer work.
-timeout = args[0]
 if len(args) > 1:
 assert len(args) == 2, "cache_page accepts at most 2 arguments"
-fn = args[1]
-assert callable(fn), "cache_page is expecting 2nd argument to be a 
callable"
-return 
decorator_from_middleware_with_args(CacheMiddleware)(timeout)(fn)
+if callable(args[0]):
+return 
decorator_from_middleware_with_args(CacheMiddleware)(args[1])(args[0])
+elif callable(args[1]):
+return 
decorator_from_middleware_with_args(CacheMiddleware)(args[0])(args[1])
+else:
+assert False, "cache_page must be passed either a single argument 
(timeout) or a view function and a timeout"
 else:
-return decorator_from_middleware_with_args(CacheMiddleware)(timeout)
+return decorator_from_middleware_with_args(CacheMiddleware)(args[0])
 
 def cache_control(**kwargs):
 

Modified: django/trunk/tests/regressiontests/decorators/tests.py
===
--- django/trunk/tests/regressiontests/decorators/tests.py  2009-09-23 
23:47:53 UTC (rev 11593)
+++ django/trunk/tests/regressiontests/decorators/tests.py  2009-09-26 
19:39:42 UTC (rev 11594)
@@ -105,7 +105,7 @@
 """
 def my_view(request):
 return "response"
-my_view_cached = cache_page(123, my_view)
+my_view_cached = cache_page(my_view, 123)
 self.assertEqual(my_view_cached(HttpRequest()), "response")
 
 class MethodDecoratorAdapterTests(TestCase):


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



Re: [Django] #8918: FileField upload_to should not be required for custom backends

2009-09-26 Thread Django
#8918: FileField upload_to should not be required for custom backends
---+
  Reporter:  leahculver| Owner:  nobody 

Status:  new   | Milestone:  1.2

 Component:  File uploads/storage  |   Version:  SVN

Resolution:|  Keywords:  FileField, files, 
upload, S3, upload_to
 Stage:  Accepted  | Has_patch:  1  

Needs_docs:  0 |   Needs_tests:  0  

Needs_better_patch:  0 |  
---+
Changes (by physicsnick):

 * cc: physicsn...@gmail.com (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #11559: urlresolvers.reverse do not work with namespaced urls and captured parameters in parent urlconf

2009-09-26 Thread Django
#11559: urlresolvers.reverse do not work with namespaced urls and captured
parameters in parent urlconf
+---
  Reporter:  kmik...@gmail.com  | Owner:  nobody
Status:  new| Milestone:
 Component:  Core framework |   Version:  SVN   
Resolution: |  Keywords:
 Stage:  Someday/Maybe  | Has_patch:  0 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  1  |  
+---
Changes (by cwb):

 * cc: calle...@gmail.com (added)
  * needs_better_patch:  0 => 1

Comment:

 In case anyone is interested in a hack -- not a proper solution -- I've
 attached a patch (against 1.1). Playing around in urlresolvers.py left me
 almost as clueless as before about its mechanics, so I'm convinced I'm
 missing edge (or non-edge!) cases. I needed this to multiply up a number
 of app URLs with various (parameterised) prefixes, giving them different
 and predictable names for reversing, but found later namespaces didn't
 support that (either) -- something to do with only one urlconf being
 searched per namespace unless I misunderstood something. Thus, I abandoned
 them and wrote a custom url include function instead. That means this hack
 has hardly seen any use.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---