Skip to content

Commit

Permalink
[desktop] Replace some LOG.warns with Log.exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Erick Tryzelaar committed May 20, 2015
1 parent 33893f3 commit dd765ad
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions desktop/core/src/desktop/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def sync(self):
if job.owner.username == SAMPLE_USERNAME:
job.doc.get().share_to_default()
except Exception, e:
LOG.warn(force_unicode(e))
LOG.exception('error syncing oozie')

try:
with transaction.atomic():
Expand All @@ -304,7 +304,7 @@ def sync(self):
if job.owner.username == SAMPLE_USERNAME:
job.doc.get().share_to_default()
except Exception, e:
LOG.warn(force_unicode(e))
LOG.exception('error syncing beeswax')

try:
with transaction.atomic():
Expand All @@ -322,7 +322,7 @@ def sync(self):
if job.owner.username == SAMPLE_USERNAME:
job.doc.get().share_to_default()
except Exception, e:
LOG.warn(force_unicode(e))
LOG.exception('error syncing pig')

try:
with transaction.atomic():
Expand All @@ -343,7 +343,7 @@ def sync(self):
Document.objects.link(dashboard_doc, owner=owner, name=dashboard.label, description=dashboard.label, extra='search-dashboard')
dashboard.save()
except Exception, e:
LOG.warn(force_unicode(e))
LOG.exception('error syncing search')

try:
with transaction.atomic():
Expand Down Expand Up @@ -372,7 +372,7 @@ def sync(self):
tag = DocumentTag.objects.get_example_tag(user=job.owner)
doc.tags.add(tag)
except Exception, e:
LOG.warn(force_unicode(e))
LOG.exception('error syncing Document2')


# Make sure doc have at least a tag
Expand All @@ -381,23 +381,23 @@ def sync(self):
default_tag = DocumentTag.objects.get_default_tag(doc.owner)
doc.tags.add(default_tag)
except Exception, e:
LOG.warn(force_unicode(e))
LOG.exception('error adding at least one tag to docs')

# For now remove the default tag from the examples
try:
for doc in Document.objects.filter(tags__tag=DocumentTag.EXAMPLE):
default_tag = DocumentTag.objects.get_default_tag(doc.owner)
doc.tags.remove(default_tag)
except Exception, e:
LOG.warn(force_unicode(e))
LOG.exception('error removing default tags')

# Delete documents with no object
try:
for doc in Document.objects.all():
if doc.content_type is None or doc.content_object is None:
doc.delete()
except Exception, e:
LOG.warn(force_unicode(e))
LOG.exception('error removing documents with no objects')


UTC_TIME_FORMAT = "%Y-%m-%dT%H:%MZ"
Expand Down

0 comments on commit dd765ad

Please sign in to comment.