"""
Project: META-SHARE prototype implementation
Author: Christian Federmann <cfedermann@dfki.de>
"""
from django.conf.urls.defaults import patterns, url
from haystack.views import search_view_factory
from haystack.query import SearchQuerySet

from metashare.repository.forms import FacetedBrowseForm
from metashare.repository.views import MetashareFacetedSearchView

sqs = SearchQuerySet() \
  .facet("languageNameFilter") \
  .facet("resourceTypeFilter") \
  .facet("mediaTypeFilter") \
  .facet("availabilityFilter") \
  .facet("licenceFilter") \
  .facet("restrictionsOfUseFilter") \
  .facet("validatedFilter") \
  .facet("foreseenUseFilter") \
  .facet("useNlpSpecificFilter") \
  .facet("lingualityTypeFilter") \
  .facet("multilingualityTypeFilter") \
  .facet("modalityTypeFilter") \
  .facet("mimeTypeFilter") \
  .facet("bestPracticesFilter") \
  .facet("domainFilter") \
  .facet("geographicCoverageFilter") \
  .facet("timeCoverageFilter") \
  .facet("subjectFilter") \
  .facet("corporaAnnotationTypeFilter") \
  .facet("corporaAnnotationFormatFilter") \
  .facet("ldLanguageDescriptionTypeFilter") \
  .facet("ldEncodingLevelFilter") \
  .facet("ldGrammaticalPhenomenaCoverageFilter") \
  .facet("lcrLexicalResourceTypeFilter") \
  .facet("lcrEncodingLevelFilter") \
  .facet("lcrLinguisticInformationFilter") \
  .facet("tsToolServiceTypeFilter") \
  .facet("tsToolServiceSubTypeFilter") \
  .facet("tsLanguageDependentTypeFilter") \
  .facet("tsInputOutputResourceTypeFilter") \
  .facet("tsInputOutputMediaTypeFilter") \
  .facet("tsAnnotationTypeFilter") \
  .facet("tsAnnotationFormatFilter") \
  .facet("tsEvaluatedFilter") \
  .facet("textTextGenreFilter") \
  .facet("textTextTypeFilter") \
  .facet("textRegisterFilter") \
  .facet("audioAudioGenreFilter") \
  .facet("audioSpeechGenreFilter") \
  .facet("audioRegisterFilter") \
  .facet("audioSpeechItemsFilter") \
  .facet("audioNaturalityFilter") \
  .facet("audioConversationalTypeFilter") \
  .facet("audioScenarioTypeFilter") \
  .facet("videoVideoGenreFilter") \
  .facet("videoTypeOfVideoContentFilter") \
  .facet("videoNaturalityFilter") \
  .facet("videoConversationalTypeFilter") \
  .facet("videoScenarioTypeFilter") \
  .facet("imageImageGenreFilter") \
  .facet("imageTypeOfImageContentFilter") \
  .facet("tnTypeOfTnContentFilter") \
  .facet("tnGramBaseItemFilter") \
  .facet("tnGramOrderFilter")

urlpatterns = patterns('metashare.repository.views',
  (r'^browse/(?P<object_id>[123456789]\d*)/$',
    'view'),
  (r'^download/(?P<object_id>[123456789]\d*)/$',
    'download'),
  url(r'^search/$',
    search_view_factory(view_class=MetashareFacetedSearchView,
                        form_class=FacetedBrowseForm,
                        template='repository/search.html',
                        searchqueryset=sqs)),
)

@@ -2450,16 +2450,24 @@
 %5Ebrowse/
+%5B%5Cw%5C-%5D*/
 (?P%3Cobje
@@ -2468,38 +2468,27 @@
 P%3Cobject_id%3E
-%5B123456789%5D%5Cd*
+%5Cw+
 )/$',%0A    'v
@@ -2509,16 +2509,24 @@
 ownload/
+%5B%5Cw%5C-%5D*/
 (?P%3Cobje
@@ -2535,22 +2535,11 @@
 _id%3E
-%5B123456789%5D%5Cd*
+%5Cw+
 )/$'

Add stable url for resources