- Timestamp:
- Sep 4, 2011, 1:46:35 PM (13 years ago)
- Location:
- src/django_gheat/wlheatmap
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/wlheatmap/__init__.py
r9544 r9658 1 1 from django.shortcuts import render_to_response 2 from django.http import HttpResponse 2 3 from django.conf import settings 4 from gheat.models import MeetBestand 5 from django.db import IntegrityError 6 7 import gheat.dataimport 8 import logging 9 10 logger = logging.getLogger(__name__) 11 logger.setLevel(logging.DEBUG) 3 12 4 13 def js_layer_base(request): 5 14 return render_to_response('js/LayerBase.js', {'settings' : settings }, 6 15 mimetype='application/javascript') 16 17 def process(request): 18 response = HttpResponse() 19 ch = logging.StreamHandler(stream=response) 20 ch.setLevel(logging.DEBUG) 21 formatter = logging.Formatter('%(levelname)-6s - %(name)-20s - %(message)s') 22 ch.setFormatter(formatter) 23 logging.getLogger().addHandler(ch) 24 25 response.write('<pre>') 26 for f in MeetBestand.objects.filter(is_imported=False): 27 logger.info("%s | %s", f.bestand.name, f.meetrondje) 28 try: 29 gheat.dataimport.import_file(f.bestand.path, f.meetrondje) 30 except IntegrityError, e: 31 logger.error(e) 32 continue 33 f.is_imported = True 34 f.save() 35 response.write('</pre>') 36 return response -
src/django_gheat/wlheatmap/urls.py
r9594 r9658 19 19 url(r'^feature/nodes.json$', 'feature.nodes_json'), 20 20 url(r'^filters/$', 'filters.serve_filters'), 21 url(r'^process/$', 'process'), 21 22 )
Note:
See TracChangeset
for help on using the changeset viewer.