frontend.afe.model_logic: Rename validate_unique
[autotest-zwu.git] / frontend / urls_common.py
blob01a914f21a18ccddda3567ffe7d0c2b882e2711c
1 import os
2 from django.conf.urls import defaults
5 def generate_patterns(django_name, gwt_name):
6 """
7 Generates the common URL patterns for the given names
9 @param django_name the full name of the Django application
10 (e.g., frontend.afe)
11 @param gwt_name the name of the GWT project (e.g., AfeClient)
12 @return the common standard and the debug pattern lists, as a tuple
13 """
15 pattern_list = defaults.patterns(
16 django_name,
17 (r'^rpc/', 'views.handle_rpc'),
18 (r'^rpc_doc', 'views.rpc_documentation'),
21 debug_pattern_list = defaults.patterns('',
22 # for GWT hosted mode
23 (r'^(?P<forward_addr>autotest.*)',
24 'autotest_lib.frontend.afe.views.gwt_forward'),
26 # for GWT compiled files
27 (r'^client/(?P<path>.*)$', 'django.views.static.serve',
28 {'document_root': os.path.join(os.path.dirname(__file__), '..',
29 'frontend', 'client', 'www')}),
30 # redirect / to compiled client
31 (r'^$', 'django.views.generic.simple.redirect_to',
32 {'url':
33 'client/autotest.%(name)s/%(name)s.html' % dict(name=gwt_name)}),
36 return (pattern_list, debug_pattern_list)