New Satchmo models - l10n

42 views
Skip to first unread message

Chris Moffitt

unread,
Sep 9, 2007, 10:34:43 PM9/9/07
to satchm...@googlegroups.com
As a followup to the webda discussions, I have checked in (via changeset 702)  the replacement as a set of models & data called l10n.  This is a backwards incompatible change but hopefully will have limited impact on users.  I just wanted to give you a heads up.

I have modified all of the existing code base to use these new models (at least I think I got it all ;).  If you have not done anything different with the existing i18n models, then you should be fine.  Just do a syncdb to install the new models and data & you should be good to go.  One special caveat, existing data linked to the old i18n models will need to be updated to point to the new models.

The one downside to my new models is that they do not include all of the data that webda included.  The timezone, language and phone number info were not included.  I don't think this is a big deal because they were not used anywhere in the shop code.  However, if you made custom changes, you may miss this data.  You are still free to use the webda code and data, it just won't be distributed with Satchmo anymore.

The upside is that this data will be automatically loaded when you do a syncdb.  Because it is all loaded in one transaction, you must ensure that your database is setup to store utf-8 characters.  Refer to the MySQL or Postgres documentation to figure out how to do it.

The other good side is that it should be relatively painless for you to submit data changes to be included back into Satchmo.  Just go into the admin and make the updates you need to the l10n data.  Then dump the data to an xml fixture like this:
python manage.py dumpdata --format=xml --indent=4 l10n > modified_data.xml

Create a ticket with the diff between this file and /l10n/fixtures/initial_data.xml

I expect that there may be some more changes in these models so don't get too comfortable with them yet.  If you have any comments or questions, let us know.

-Chris

Frédéric Roland

unread,
Sep 15, 2007, 5:19:18 PM9/15/07
to satchm...@googlegroups.com
Hi,

I have satchmo rev 722 and after installing everyting (mod_python,...) I
launched load_data.py and got the following error.

"ccbe.l10n_country' doesn't exist"

ccbe is the database name.

I have Django svn version 6328 (post sprint).

I noticed a lot of ^M in the l10n model file.

I retried to syncdb and the model for the Country was not created in the
MySql db.

Does it is possible that the l10n has not been imported because of the
^M in it ?

F. Roland

Chris Moffitt a écrit :

John Shaffer

unread,
Sep 15, 2007, 5:25:40 PM9/15/07
to satchm...@googlegroups.com
On 9/15/07, Frédéric Roland <frederi...@creativeconvergence.info> wrote:
> Does it is possible that the l10n has not been imported because of the
> ^M in it ?

It's possible. Does revision 723 work for you?

Frédéric Roland

unread,
Sep 15, 2007, 5:26:42 PM9/15/07
to satchm...@googlegroups.com
Oops I added satchmo.l10n to the installed apps and the error was fixed.

Frédéric Roland

unread,
Sep 15, 2007, 5:55:35 PM9/15/07
to satchm...@googlegroups.com
Thanks.
In fact the problem was related to l10n app not being in installed apps
by default.

Now installation fail a bit later. I'll try to fix it or I'll post a new
thread.

F. Roland

John Shaffer a écrit :

Loe Spee

unread,
Sep 15, 2007, 8:02:26 PM9/15/07
to satchm...@googlegroups.com
Maybe it's an idea to open a page on the Trac Wiki with common "installation/setup" mistakes.
I had a few myself, just everytime somebody walks into a problem and finds out what to do to fix it, he/she should add it to the Wiki, just to help others, and it's way more convenient to find then on the mailinglist. So it's not for posting errors people get and are looking for a fix, just common mistakes in configuration or something alike, including a fix of course.

Maybe you don't agree on this idea, let me know.

- Loe Spee

Chris Moffitt

unread,
Sep 16, 2007, 2:44:58 PM9/16/07
to satchm...@googlegroups.com

On 9/15/07, Loe Spee <ma...@lnet.nl> wrote:
Maybe it's an idea to open a page on the Trac Wiki with common "installation/setup" mistakes.

I like the idea.  I've created a page here -
http://www.satchmoproject.com/trac/wiki/InstallationHints

-Chris

Loe Spee

unread,
Sep 16, 2007, 3:08:57 PM9/16/07
to satchm...@googlegroups.com
Thanks Chris, I will do a complete reinstall of Satchmo on a new OS install the coming days, I will post anything that might be a problem or pitfall for new users on the Wiki.

Frédéric Roland

unread,
Sep 16, 2007, 3:50:59 PM9/16/07
to satchm...@googlegroups.com
Hi,
I'm doing a new install and here is where I'm having problems:

It's with Satchmo svn rev # 727 and Django svn rev # 6364.

Type 'yes' to erase ALL data and reinstall ALL models: no
Type 'yes' to erase any existing Satchmo data and reinstall all models: yes
Deleting existing Satchmo data.
Deleting satchmo.shop
Deleting satchmo.supplier
Deleting satchmo.payment
Deleting satchmo.discount
Deleting satchmo.contact
Deleting satchmo.product
Deleting satchmo.tax
Deleting satchmo.l10n
Satchmo data successfully deleted.
Calling syncdb
Loading 'initial_data' fixtures...
Installing xml fixture 'initial_data' from absolute path.
Problem installing fixture 'initial_data.xml': Data truncated for column
'name' at row 1
Loading 'l10n_data' fixtures...
Installing xml fixture 'l10n_data' from
'/home/ccbe/satchmo_src/satchmo/l10n/fixtures'.
Problem installing fixture
'/home/ccbe/satchmo_src/satchmo/l10n/fixtures/l10n_data.xml': Data
truncated for column 'name' at row 1
Type 'yes' to load sample store data: yes
Creating site...
Creating Customers...
Creating Suppliers...
Creating Categories...
Creating products...
Creating product variations...
Create a test user...
Type 'yes' to load a tax table for the US: yes
Traceback (most recent call last):
File "load_data.py", line 351, in ?
load_US_tax_table()
File "load_data.py", line 334, in load_US_tax_table
state = AdminArea.objects.get(country=us, abbrev=row[0])
File "/home/ccbe/django_src/django/db/models/manager.py", line 69, in get
return self.get_query_set().get(*args, **kwargs)
File "/home/ccbe/django_src/django/db/models/query.py", line 263, in get
raise self.model.DoesNotExist, "%s matching query does not exist."
% self.model._meta.object_name
django.db.models.base.DoesNotExist: AdminArea matching query does not exist.


F.Roland

Chris Moffitt

unread,
Sep 16, 2007, 4:24:45 PM9/16/07
to satchm...@googlegroups.com
My guess is that there is a problem with your database accepting the unicode characters.  If you're using MySql, make sure that it is setup to utf8

For my setup, I made the following change to /etc/mysql/my.cnf

[mysqld]
character-set-server            = utf8
default-character-set           = utf8

See if that works.

-Chris

Frédéric Roland

unread,
Sep 16, 2007, 4:32:05 PM9/16/07
to satchm...@googlegroups.com
Hi Chris,

The server is set up for Latin1 and I can't change it as it's working
like that for a client but I did changed charset and locale to utf8 and
utf8_general_ci in db.opt file. Isn't it sufficient ?

Frédéric

Chris Moffitt a écrit :

Chris Moffitt

unread,
Sep 16, 2007, 4:40:22 PM9/16/07
to satchm...@googlegroups.com
That should be sufficient.

Can you look at the satchmo.l10n tables and see what collation value the fields are?  In mine, they are set to utf8_general_ci and that seems to work.

-Chris

Frédéric Roland

unread,
Sep 16, 2007, 5:26:57 PM9/16/07
to satchm...@googlegroups.com
The tables are latin1_swedish_ci even after having put utf8 in db.opt
and launch load_data.py and answer no to reset everything and yes to
reset satchmo.

I fear to break existing websites by doing changes to my.conf.

I will try to manually change collation on the tables used by the fixture.

Chris Moffitt a écrit :

Frédéric Roland

unread,
Sep 16, 2007, 5:53:29 PM9/16/07
to satchm...@googlegroups.com
I modified Load_data.py to have character set and colation in the create
database statement.

load_data.py: 'create database %s CHARACTER SET utf8
COLLATE utf8_general_ci']:

After that I relaunched load_data and everything was ok up to the point
that I can see the homepage of the demo store.

But when I click a link to a product I have

TemplateSyntaxError at /product/PY-Rocks/
'comments' is not a valid tag library: Could not load template library
from django.templatetags.comments, No module named comments
Request Method: GET
Request URL: http://www.creativeconvergence.be/product/PY-Rocks/
Exception Type: TemplateSyntaxError
Exception Value: 'comments' is not a valid tag library: Could not load
template library from django.templatetags.comments, No module named comments
Exception Location:
/home/ccbe/django_src/django/template/defaulttags.py in load, line 801
Python Executable: /usr/bin/python
Python Version: 2.4.3

but this is something in the last release of settings-customize.py I
didn't copied in my settings.py which is older from several releases.

I have almost a working shop, I hope to style it a little bit and start
customize it really soon. Thanks for your help.


Frédéric Roland a écrit :


> The tables are latin1_swedish_ci even after having put utf8 in db.opt
> and launch load_data.py and answer no to reset everything and yes to
> reset satchmo.
>
> I fear to break existing websites by doing changes to my.conf.
>
> I will try to manually change collation on the tables used by the fixture.
>

> Chris Moffitt a �crit :

Chris Moffitt

unread,
Sep 16, 2007, 8:56:00 PM9/16/07
to satchm...@googlegroups.com
That's a good idea about adding the CHARACTER SET to the db creation.  I'll make that change in the MySql load_data code.

You're current problem is with the comment_utils.  Check out this page for more details-
http://www.satchmoproject.com/trac/wiki/BackwardsIncompatibleChangesAfter0.5

-Chris

Reply all
Reply to author
Forward
0 new messages