django-oauth : oauth_provider_consumer のフィールドサイズが小さい(場合がある)ようだ。
(cmd)hdknr@deblen:~/.ve/cmd/src/cheese$ python manage.py shell
Python 2.5.2 (r252:60911, Jan 4 2009, 17:40:26)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from oauth_provider.models import Resource, Consumer
>>> C=('urx5MG8VAyGgqnHtOwhYQ','ds6H1xo8inXxmoV4x7k8Q8o7kxNVFbDeKQsUFjNVBs')
>>> consumer=Consumer(key=C[0],secret=C[1],name='www.yammer.com')
>>> consumer.save()
Traceback (most recent call last):
File "", line 1, in
File
"/home/hdknr/.ve/cmd/lib/python2.5/site-packages/django/db/models/base.py",
line 410, in save
self.save_base(force_insert=force_insert, force_update=force_update)
File
"/home/hdknr/.ve/cmd/lib/python2.5/site-packages/django/db/models/base.py",
line 495, in save_base
result = manager._insert(values, return_id=update_pk)
File
"/home/hdknr/.ve/cmd/lib/python2.5/site-packages/django/db/models/manager.py",
line 177, in _insert
return insert_query(self.model, values, **kwargs)
File
"/home/hdknr/.ve/cmd/lib/python2.5/site-packages/django/db/models/query.py",
line 1087, in insert_query
return query.execute_sql(return_id)
File
"/home/hdknr/.ve/cmd/lib/python2.5/site-packages/django/db/models/sql/subqueries.py",
line 320, in execute_sql
cursor = super(InsertQuery, self).execute_sql(None)
File
"/home/hdknr/.ve/cmd/lib/python2.5/site-packages/django/db/models/sql/query.py",
line 2369, in execute_sql
cursor.execute(sql, params)
File
"/home/hdknr/.ve/cmd/lib/python2.5/site-packages/django/db/backends/util.py",
line 19, in execute
return self.cursor.execute(sql, params)
File
"/home/hdknr/.ve/cmd/lib/python2.5/site-packages/django/db/backends/mysql/base.py",
line 84, in execute
return self.cursor.execute(query, args)
File "build/bdist.linux-i686/egg/MySQLdb/cursors.py", line 175, in execute
if not self._defer_warnings: self._warning_check()
File "build/bdist.linux-i686/egg/MySQLdb/cursors.py", line 89, in
_warning_check
warn(w[-1], self.Warning, 3)
File "/usr/lib/python2.5/warnings.py", line 62, in warn
globals)
File "/usr/lib/python2.5/warnings.py", line 102, in warn_explicit
raise message
Warning: Data truncated for column 'secret' at row 1
oauth_provider_consumer" | mysql -u cheese --password=cheese cheese -t
+----+----------------+-------------+-----------------------+------------------+--------+---------+
| id | name | description | key | secret | status | user_id |
+----+----------------+-------------+-----------------------+------------------+--------+---------+
| 1 | www.yammer.com | | urx5MG8VAyGgqnHtOwhYQ | ds6H1xo9inXUmoV3 | 1 |
NULL |
| 2 | www.yammer.com | | urx5MG8VAyGgqnHtOwhYQ | ds6H1xo9inXUmoV3 | 1 |
NULL |
+----+----------------+-------------+-----------------------+------------------+--------+---------+
2回やったから。 (cmd)hdknr@deblen:~/.ve/cmd $ echo "desc oauth_provider_consumer" |
mysql -u cheese --password=cheese cheese -t
+-------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(255) | NO | | NULL | |
| description | longtext | NO | | NULL | |
| key | varchar(256) | NO | | NULL | |
| secret | varchar(16) | NO | | NULL | |
| status | smallint(6) | NO | | NULL | |
| user_id | int(11) | YES | MUL | NULL | |
+-------------+--------------+------+-----+---------+----------------+ (cmd)hdknr@deblen:~/.ve/cmd/src/cheese$ echo "drop table
oauth_provider_consumer" | mysql -u cheese --password=cheese cheese (cmd)hdknr@deblen:~/.ve/cmd/lib/python2.5/site-packages/django_oauth-1.0-py2.5.egg/oauth_provider$
vi consts.py
SECRET_SIZE = 256 (cmd)hdknr@deblen:~/.ve/cmd/src/cheese$ python manage.py syncdb
Creating table oauth_provider_consumer
Installing index for oauth_provider.Consumer model (cmd)hdknr@deblen:~/.ve/cmd/src/cheese$ python manage.py shell
Python 2.5.2 (r252:60911, Jan 4 2009, 17:40:26)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from oauth_provider.models import Resource, Consumer
>>> C=('urx5MG8VAyGgqnHtOwhYQ','ds6H1xo8inXxmoV4x7k8Q8o7kxNVFbDeKQsUFjNVBs')
>>> consumer=Consumer(key=C[0],secret=C[1],name='www.yammer.com')
>>> consumer.save()
>>> (cmd)hdknr@deblen:~/.ve/cmd/src/cheese$ python manage.py dbshell
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 528
Server version: 5.0.51a-24+lenny2-log (Debian) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> select * from oauth_provider_consumer
-> ;
+----+----------------+-------------+-----------------------+--------------------------------------------+--------+---------+
| id | name | description | key | secret | status | user_id |
+----+----------------+-------------+-----------------------+--------------------------------------------+--------+---------+
| 1 | www.yammer.com | | urx5MG8VAyGgqnHtOwhYQ |
ds6H1xo8inXxmoV4x7k8Q8o7kxNVFbDeKQsUFjNVBs | 1 | NULL |
+----+----------------+-------------+-----------------------+--------------------------------------------+--------+---------+
1 row in set (0.00 sec)

Comments [0]