This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
namespace Bleroy.Helpers { | |
public static class NotNull { | |
public static TProp Get<TSource, TProp>(this TSource source, Expression<Func<TSource, TProp>> property) where TSource : class { | |
if (source == null) return default(TProp); | |
var current = property.Body; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
from tastypie.models import ApiKey, ApiAccess | |
admin.site.unregister(ApiKey) | |
admin.site.unregister(ApiAccess) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LoggingMixin(object): | |
def dispatch(self, request_type, request, **kwargs): | |
logger.debug( | |
'%s %s %s' % | |
(request.method, request.get_full_path(), request.raw_post_data)) | |
try: | |
response = super(LoggingMixin, self).dispatch( | |
request_type, request, **kwargs) | |
except (BadRequest, fields.ApiFieldError), e: |