mirror of
https://github.com/fergalmoran/dss.git
synced 2025-12-25 11:07:35 +00:00
Fixed output logging
This commit is contained in:
@@ -23,8 +23,11 @@ git+git://github.com/spookylukey/django-paypal.git#django-paypal
|
||||
git+git://github.com/llazzaro/django-scheduler.git#django-scheduler
|
||||
git+git://github.com/cyberdelia/django-pipeline.git#django-pipeline
|
||||
git+git://github.com/disqus/django-bitfield.git#django-bitfield
|
||||
git+git://github.com/fergalmoran/azure-sdk-for-python.git#azure
|
||||
django-templated-email
|
||||
django-grappelli
|
||||
django-nose
|
||||
djangorestframework
|
||||
humanize
|
||||
mandrill
|
||||
django-debug-toolbar
|
||||
@@ -60,4 +63,3 @@ python-shout
|
||||
django-dirtyfields
|
||||
django-storages
|
||||
django-user-sessions
|
||||
apache-libcloud
|
||||
@@ -1,5 +1,5 @@
|
||||
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
|
||||
from django.db.models import Count, Q
|
||||
from django.db.models import Count, Q, F
|
||||
from tastypie import fields
|
||||
from tastypie.authentication import Authentication
|
||||
from tastypie.authorization import Authorization
|
||||
@@ -74,10 +74,6 @@ class UserResource(BaseResource):
|
||||
return super(UserResource, self).obj_create(bundle, **kwargs)
|
||||
|
||||
def obj_update(self, bundle, skip_errors=False, **kwargs):
|
||||
update_geo_info_task.delay(
|
||||
ip_address=bundle.request.META['REMOTE_ADDR'],
|
||||
profile_id=bundle.request.user.get_profile().id
|
||||
)
|
||||
return super(UserResource, self).obj_update(bundle, skip_errors, **kwargs)
|
||||
|
||||
def _create_playlist(self, request):
|
||||
@@ -150,7 +146,7 @@ class UserResource(BaseResource):
|
||||
likes = UserProfile.ACTIVITY_SHARE_LIKES if bundle.data['activity_sharing_likes'] else 0
|
||||
favourites = UserProfile.ACTIVITY_SHARE_FAVOURITES if bundle.data['activity_sharing_favourites'] else 0
|
||||
comments = UserProfile.ACTIVITY_SHARE_COMMENTS if bundle.data['activity_sharing_comments'] else 0
|
||||
bundle.data['activity_sharing'] = (likes | favourites | comments)
|
||||
bundle.data['activity_sharing'] = (plays | likes | favourites | comments)
|
||||
del bundle.data['activity_sharing_plays']
|
||||
del bundle.data['activity_sharing_likes']
|
||||
del bundle.data['activity_sharing_favourites']
|
||||
@@ -165,6 +161,13 @@ class UserResource(BaseResource):
|
||||
del bundle.data['activity_sharing_networks_facebook']
|
||||
del bundle.data['activity_sharing_networks_twitter']
|
||||
|
||||
bundle.data['email_notifications'] = \
|
||||
UserProfile.email_notifications.plays if bundle.data['email_notification_plays'] else False | \
|
||||
UserProfile.email_notifications.likes if bundle.data['email_notification_likes'] else False | \
|
||||
UserProfile.email_notifications.favourites if bundle.data['email_notification_favourites'] else False | \
|
||||
UserProfile.email_notifications.follows if bundle.data['email_notification_follows'] else False | \
|
||||
UserProfile.email_notifications.comments if bundle.data['email_notification_comments'] else False
|
||||
|
||||
return bundle
|
||||
|
||||
def get_followers(self, request, **kwargs):
|
||||
|
||||
25
spa/audio.py
25
spa/audio.py
@@ -8,6 +8,7 @@ import json
|
||||
from django.http import Http404, HttpResponse, HttpResponseForbidden, HttpResponseNotFound, HttpResponseRedirect
|
||||
from django.core.servers.basehttp import FileWrapper
|
||||
from django.shortcuts import redirect
|
||||
from django.utils import simplejson
|
||||
from django.utils.encoding import smart_str
|
||||
from nginx_signing.signing import UriSigner
|
||||
from sendfile import sendfile
|
||||
@@ -39,25 +40,19 @@ def download(request, mix_id):
|
||||
mix = Mix.objects.get(pk=mix_id)
|
||||
if mix is not None:
|
||||
if mix.download_allowed:
|
||||
response = {
|
||||
'url': '',
|
||||
'filename': smart_str('Deep South Sounds - %s.%s' % (mix.title, mix.filetype)),
|
||||
'mime_type': 'application/octet-stream'
|
||||
}
|
||||
if mix.archive_path in [None, '']:
|
||||
audio_file = mix.get_absolute_path()
|
||||
filename, extension = os.path.splitext(audio_file)
|
||||
if os.path.exists(audio_file):
|
||||
return sendfile(
|
||||
request,
|
||||
audio_file,
|
||||
attachment=True,
|
||||
attachment_filename='Deep South Sounds - %s%s' % (
|
||||
mix.title, extension
|
||||
)
|
||||
)
|
||||
response['url'] = audio_file.name
|
||||
else:
|
||||
response = HttpResponseRedirect(mix.archive_path)
|
||||
"""
|
||||
response['Content-Disposition'] = 'attachment; filename=' + \
|
||||
smart_str('Deep South Sounds - %s%s' % (mix.title, mix.filetype))
|
||||
"""
|
||||
return response
|
||||
response['url'] = mix.archive_path
|
||||
|
||||
return HttpResponse(json.dumps(response))
|
||||
else:
|
||||
return HttpResponse('Downloads not allowed for this mix', status=401)
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class Command(NoArgsCommand):
|
||||
x_ms_blob_content_type='application/octet-stream',
|
||||
x_ms_blob_content_disposition='attachment;filename="%s"' % download_name
|
||||
)
|
||||
print "Processed: %s" % download_name
|
||||
print "Processed: %s" % mix.uid
|
||||
else:
|
||||
print "No blob found for: %s" % mix.uid
|
||||
except WindowsAzureMissingResourceError:
|
||||
|
||||
@@ -151,6 +151,9 @@ class UserProfile(BaseModel):
|
||||
try:
|
||||
if self.avatar_type == 'custom':
|
||||
image = self.avatar_image
|
||||
if image.name.startswith('http'):
|
||||
return image.name
|
||||
|
||||
image = "%s%s" % (settings.MEDIA_URL, get_thumbnail(image, "32x32", crop='center').name)
|
||||
return image
|
||||
except SuspiciousOperation, ex:
|
||||
|
||||
@@ -57,14 +57,13 @@ def create_profile(sender, **kw):
|
||||
|
||||
post_save.connect(create_profile, sender=User)
|
||||
|
||||
|
||||
def post_save_handler(**kwargs):
|
||||
"""
|
||||
Doing signals for notifications here.
|
||||
I like this method because I have a single signal
|
||||
and just check for a hook method on the sender
|
||||
"""
|
||||
|
||||
|
||||
def post_save_handler(**kwargs):
|
||||
instance = kwargs['instance']
|
||||
# should save generate a notification to a target user
|
||||
if hasattr(instance, 'post_social'):
|
||||
|
||||
@@ -2,8 +2,8 @@ from django.conf import settings
|
||||
from django.core.files.storage import Storage
|
||||
from django.core.files.base import ContentFile
|
||||
|
||||
import azure
|
||||
from azure.storage import *
|
||||
import azure_util
|
||||
from azure_util.storage import *
|
||||
from datetime import datetime
|
||||
import os, mimetypes
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
ref = this
|
||||
@_saveChanges
|
||||
success: ->
|
||||
"""
|
||||
if ref.model.get('avatar_type') is "custom"
|
||||
$.ajaxFileUpload
|
||||
url: "ajax/upload_avatar_image/"
|
||||
@@ -51,6 +52,7 @@
|
||||
utils.showError e
|
||||
|
||||
else
|
||||
"""
|
||||
toastr.info "Successfully updated yourself"
|
||||
alert("What to do")
|
||||
"""
|
||||
|
||||
@@ -108,26 +108,42 @@
|
||||
v.toString 16
|
||||
|
||||
downloadURL: (url) ->
|
||||
"""
|
||||
$.getJSON url, (data) =>
|
||||
$.fileDownload(data.url)
|
||||
successCallback: (url) ->
|
||||
alert "You just got a file download dialog or ribbon for this URL :" + url
|
||||
return
|
||||
|
||||
failCallback: (html, url) ->
|
||||
alert "Your file download just failed for this URL:" + url + "\r\n" + "Here was the resulting error HTML: \r\n" + html
|
||||
return
|
||||
"""
|
||||
iframe = document.getElementById("if_dl_misecure")
|
||||
if iframe is null
|
||||
iframe = document.createElement("iframe")
|
||||
iframe.id = "if_dl_misecure"
|
||||
iframe.style.visibility = "hidden"
|
||||
document.body.appendChild iframe
|
||||
iframe.src = url
|
||||
$.getJSON url, (response) ->
|
||||
utils.download(response.url, response.filename, response.mime_type)
|
||||
true
|
||||
|
||||
download: (strData, strFileName, strMimeType) ->
|
||||
D = document
|
||||
a = D.createElement("a")
|
||||
strMimeType = strMimeType or "application/octet-stream"
|
||||
if navigator.msSaveBlob # IE10
|
||||
return navigator.msSaveBlob(new Blob([strData],
|
||||
type: strMimeType
|
||||
), strFileName)
|
||||
# end if(navigator.msSaveBlob)
|
||||
if "download_ignore" of a #html5 A[download]
|
||||
a.href = "data:" + strMimeType + "," + encodeURIComponent(strData)
|
||||
a.setAttribute "download", strFileName
|
||||
a.innerHTML = "downloading..."
|
||||
D.body.appendChild a
|
||||
setTimeout (->
|
||||
a.click()
|
||||
#D.body.removeChild a
|
||||
return
|
||||
), 66
|
||||
return true
|
||||
# end if('download' in a)
|
||||
|
||||
#do iframe dataURL download (old ch+FF):
|
||||
f = D.createElement("iframe")
|
||||
D.body.appendChild f
|
||||
#f.src = "data:" + strMimeType + "," + encodeURIComponent(strData)
|
||||
f.src = strData
|
||||
setTimeout (->
|
||||
D.body.removeChild f
|
||||
return
|
||||
), 333
|
||||
true
|
||||
isAuth: ->
|
||||
com.podnoms.settings.currentUser != -1
|
||||
|
||||
|
||||
@@ -93,7 +93,8 @@
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="activity_sharing_favourites" class="ace"
|
||||
<input type="checkbox" name="activity_sharing_favourites"
|
||||
class="ace"
|
||||
id="activity_sharing_favourites" <%= renderCheckbox(activity_sharing_favourites) %>>
|
||||
<span class="lbl"> Favourites</span>
|
||||
</label>
|
||||
@@ -156,21 +157,21 @@
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="email_notification_plays" class="ace"
|
||||
<input type="checkbox" name="email_notification_likes" class="ace"
|
||||
id="email_notification_likes" <%= renderCheckbox(email_notification_likes) %>>
|
||||
<span class="lbl"> Likes</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="email_notification_plays" class="ace"
|
||||
<input type="checkbox" name="email_notification_favourites" class="ace"
|
||||
id="email_notification_favourites" <%= renderCheckbox(email_notification_favourites) %>>
|
||||
<span class="lbl"> Favourites</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="email_notification_plays" class="ace"
|
||||
<input type="checkbox" name="email_notification_comments" class="ace"
|
||||
id="email_notification_comments" <%= renderCheckbox(email_notification_comments) %>>
|
||||
<span class="lbl"> Comments</span>
|
||||
</label>
|
||||
@@ -181,6 +182,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user