From: Marcin Koziej Date: Wed, 4 Apr 2012 09:11:58 +0000 (+0200) Subject: fixes to localepack X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/d82209da8b4ed8cda90275eae128e87e0b887279?ds=sidebyside;hp=--cc fixes to localepack --- d82209da8b4ed8cda90275eae128e87e0b887279 diff --git a/apps/infopages/migrations/0004_auto__del_field_infopage_left_column_jp__del_field_infopage_title_jp__.py b/apps/infopages/migrations/0004_auto__del_field_infopage_left_column_jp__del_field_infopage_title_jp__.py new file mode 100644 index 000000000..cc453e032 --- /dev/null +++ b/apps/infopages/migrations/0004_auto__del_field_infopage_left_column_jp__del_field_infopage_title_jp__.py @@ -0,0 +1,72 @@ +# encoding: utf-8 +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + +class Migration(SchemaMigration): + + def forwards(self, orm): + + # Deleting field 'InfoPage.left_column_jp' + db.delete_column('infopages_infopage', 'left_column_jp') + + # Deleting field 'InfoPage.title_jp' + db.delete_column('infopages_infopage', 'title_jp') + + # Deleting field 'InfoPage.right_column_jp' + db.delete_column('infopages_infopage', 'right_column_jp') + + + def backwards(self, orm): + + # Adding field 'InfoPage.left_column_jp' + db.add_column('infopages_infopage', 'left_column_jp', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False) + + # Adding field 'InfoPage.title_jp' + db.add_column('infopages_infopage', 'title_jp', self.gf('django.db.models.fields.CharField')(max_length=120, null=True, blank=True), keep_default=False) + + # Adding field 'InfoPage.right_column_jp' + db.add_column('infopages_infopage', 'right_column_jp', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False) + + + models = { + 'infopages.infopage': { + 'Meta': {'ordering': "('main_page', 'slug')", 'object_name': 'InfoPage'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'left_column': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'left_column_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'left_column_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'left_column_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'left_column_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'left_column_it': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'left_column_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'left_column_pl': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'left_column_ru': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'left_column_uk': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'main_page': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'right_column': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'right_column_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'right_column_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'right_column_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'right_column_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'right_column_it': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'right_column_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'right_column_pl': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'right_column_ru': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'right_column_uk': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'}), + 'title_de': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': True, 'blank': True}), + 'title_en': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': True, 'blank': True}), + 'title_es': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': True, 'blank': True}), + 'title_fr': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': True, 'blank': True}), + 'title_it': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': True, 'blank': True}), + 'title_lt': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': True, 'blank': True}), + 'title_pl': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': True, 'blank': True}), + 'title_ru': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': True, 'blank': True}), + 'title_uk': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': True, 'blank': True}) + } + } + + complete_apps = ['infopages'] diff --git a/apps/wolnelektury_core/management/commands/localepack.py b/apps/wolnelektury_core/management/commands/localepack.py index 147b51ceb..12413a31b 100644 --- a/apps/wolnelektury_core/management/commands/localepack.py +++ b/apps/wolnelektury_core/management/commands/localepack.py @@ -9,6 +9,7 @@ import os import shutil import tempfile import sys +import zipfile import allauth @@ -144,8 +145,15 @@ class Command(BaseCommand): return os.popen("git branch |grep '^[*]' | cut -c 3-").read() def save(self, options): + packname = options.get('outfile') + packname_b = os.path.basename(packname).split('.')[0] + fmt = '.'.join(os.path.basename(packname).split('.')[1:]) + + if fmt != 'zip': + raise NotImplementedError('Sorry. Only zip format supported at the moment.') + tmp_dir = tempfile.mkdtemp('-wl-locale') - out_dir = os.path.join(tmp_dir, 'wl-locale') + out_dir = os.path.join(tmp_dir, packname) os.mkdir(out_dir) try: @@ -163,10 +171,14 @@ class Command(BaseCommand): rf.write(rev) rf.close() - packname = options.get('outfile') - packname_b = os.path.basename(packname).split('.')[0] - fmt = '.'.join(os.path.basename(packname).split('.')[1:]) - shutil.make_archive(packname_b, fmt, root_dir=os.path.dirname(out_dir), base_dir=os.path.basename(out_dir)) + + cwd = os.getcwd() + try: + os.chdir(os.path.dirname(out_dir)) + self.system('zip -r %s %s' % (os.path.join(cwd, packname_b+'.zip'), os.path.basename(out_dir))) + finally: + os.chdir(cwd) + # shutil.make_archive(packname_b, fmt, root_dir=os.path.dirname(out_dir), base_dir=os.path.basename(out_dir)) finally: shutil.rmtree(tmp_dir, ignore_errors=True)