collection_code_regex = '(?:%s|%s)' % (collection_published_code_regex,
collection_unpublished_code_regex)
- item_published_code_regex = '[A-Za-z0-9._-]*'
- item_unpublished_code_regex = '[A-Za-z0-9._-]*'
+ # Special code regex of items for the branch
+ item_published_code_regex = collection_published_code_regex + '(?:_[0-9]{2,3}){1,2}'
+ item_unpublished_code_regex = collection_unpublished_code_regex + '_[0-9]{2,3}(?:_[0-9]{2,3}){0,2}'
item_code_regex = '(?:%s|%s)' % (item_published_code_regex, item_unpublished_code_regex)
-PUBLIC_ACCESS_CHOICES = (('none', 'none'), ('metadata', 'metadata'), ('full', 'full'))
+PUBLIC_ACCESS_CHOICES = (('none', _('none')), ('metadata', _('metadata')),
+ ('mixed', _('mixed')), ('full', _('full')))
ITEM_TRANSODING_STATUS = ((0, _('broken')), (1, _('pending')), (2, _('processing')),
(3, _('done')), (5, _('ready')))
external_references = TextField(_('published references'))
copied_from_item = WeakForeignKey('self', related_name="copies",
verbose_name=_('copy of'))
- mimetype = CharField(_('mime type'), max_length=255, blank=True)
++ mimetype = CharField(_('mime type'), max_length=255, blank=True)
+ auto_period_access = BooleanField(_('automatic access after a rolling period'), default=True)
# Media
file = FileField(_('file'), upload_to='items/%Y/%m/%d',
response['Content-Length'] = os.path.getsize(filename)
return response
++<<<<<<< HEAD
+def nginx_media_accel(request, filename):
+ """Send a protected medie file through nginx with X-Accel-Redirect"""
+
+ response = HttpResponse()
+ url = settings.MEDIA_URL + filename
+ # let nginx determine the correct content type
+ response['Content-Type'] = ""
+ response['X-Accel-Redirect'] = url
+ return response
+
++=======
++>>>>>>> crem
def render(request, template, data = None, mimetype = None):
return render_to_response(template, data, context_instance=RequestContext(request),
mimetype=mimetype)