correct some small problems with urls in mails. set final version
authorymh <ymh.work@gmail.com>
Thu, 02 Jul 2015 19:48:57 +0200
changeset 632 eff2287e93fb
parent 631 bed872f13d1f
child 633 bc639e8d3a4c
correct some small problems with urls in mails. set final version
src/hdabo/management/commands/import_rdf.py
src/hdalab/__init__.py
src/hdalab/config.py.tmpl
src/hdalab/management/commands/send_moderation_mail.py
--- a/src/hdabo/management/commands/import_rdf.py	Tue Jun 23 02:24:56 2015 +0200
+++ b/src/hdabo/management/commands/import_rdf.py	Thu Jul 02 19:48:57 2015 +0200
@@ -838,14 +838,13 @@
         if any([t not in TYPES_LIST for t in self.types_list]):
             raise CommandError("Types is %r : all types mus be in %r" % (self.types_list, TYPES_LIST))
 
-        connection = connections[DEFAULT_DB_ALIAS]
-        sql_temp, _ = connection.creation.sql_create_model(ProcessedObjects, no_style(), [])
-        cursor = connection.cursor()
-        for stmt in sql_temp:
-            cursor.execute(stmt.replace("CREATE TABLE", "CREATE TEMPORARY TABLE"))
+        with transaction.atomic():
+            connection = connections[DEFAULT_DB_ALIAS]
+            sql_temp, _ = connection.creation.sql_create_model(ProcessedObjects, no_style(), [])
+            cursor = connection.cursor()
+            for stmt in sql_temp:
+                cursor.execute(stmt.replace("CREATE TABLE", "CREATE TEMPORARY TABLE"))
 
-        transaction.set_dirty()
-        transaction.commit()
         #lines = options.get('lines', 0)
         #self.ignore_existing = options.get('ignore_existing', False)
 
@@ -923,7 +922,6 @@
             print("    Obj: {object_name} -> created: {created:d}, updated: {updated:d}, deleted: {deleted:d}, untouched: {untouched:d}".format(**obj_stat))
         print("")
 
-        #print(graph_disk_cache.temp_folder)
         shutil.rmtree(graph_disk_cache.temp_folder)
 
-#]
+
--- a/src/hdalab/__init__.py	Tue Jun 23 02:24:56 2015 +0200
+++ b/src/hdalab/__init__.py	Thu Jul 02 19:48:57 2015 +0200
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 from __future__ import absolute_import
 
-VERSION = (3, 0, 0, "rc", 17)
+VERSION = (3, 0, 0, "final", 0)
 
 
 def get_version():
--- a/src/hdalab/config.py.tmpl	Tue Jun 23 02:24:56 2015 +0200
+++ b/src/hdalab/config.py.tmpl	Thu Jul 02 19:48:57 2015 +0200
@@ -30,6 +30,8 @@
 BASE_DIR = os.path.dirname(os.path.abspath(__file__)).rstrip("/") + "/"
 BASE_URL = '/~ymh/hdabo/'
 WEB_URL = 'http://localhost'
+#used when need to resolve url outside web context (in a commmand for example)
+SCRIPT_PREFIX = BASE_URL + 'hdalab'
 
 LOCALE_PATHS = ( os.path.join(BASE_DIR, 'locale',), )
 
--- a/src/hdalab/management/commands/send_moderation_mail.py	Tue Jun 23 02:24:56 2015 +0200
+++ b/src/hdalab/management/commands/send_moderation_mail.py	Thu Jul 02 19:48:57 2015 +0200
@@ -13,6 +13,7 @@
 from django.core import mail
 from django.core.mail.message import EmailMultiAlternatives
 from django.core.management.base import NoArgsCommand
+from django.core.urlresolvers import set_script_prefix
 from django.template.base import TemplateDoesNotExist
 from django.template.loader import render_to_string
 import premailer
@@ -28,6 +29,8 @@
     
     def handle_noargs(self, **options):
         # query renkan to moderate
+        set_script_prefix(settings.SCRIPT_PREFIX)
+        
         renkan_query = HdalabRenkan.objects.filter(state=HdalabRenkan.MODERATED)
         
         renkan_count = renkan_query.count()