Ticket #89: webroot-urls-fix.patch

File webroot-urls-fix.patch, 8.8 KB (added by [email protected]…, 14 years ago)

A patch that fix Url in a way that is friendly with the django way

  • bcfg2/debian/bcfg2-server.install

    diff --git a/bcfg2/debian/bcfg2-server.install b/bcfg2/debian/bcfg2-server.install
    index 5b1b918..956b7c3 100644
    a b debian/tmp/usr/bin/bcfg2-* usr/sbin 
    22debian/tmp/usr/lib/python*/site-packages/Bcfg2/Server/* 
    33debian/tmp/usr/share/bcfg2/* 
    44debian/tmp/usr/share/man/man8/* 
     5reports/site_media* /usr/share/bcfg2/Reports 
  • new file cfg2/src/lib/Server/Reports/reports/urls.py

    diff --git a/bcfg2/src/lib/Server/Reports/reports/urls.py b/bcfg2/src/lib/Server/Reports/reports/urls.py
    new file mode 100644
    index 0000000..b878978
    - +  
     1from django.conf.urls.defaults import * 
     2from django.conf import settings 
     3 
     4urlpatterns = patterns('', 
     5    # Example: 
     6    # (r'^%sBcfg2.Server.Reports/' % web_prefix, include('Bcfg2.Server.Reports.apps.foo.urls.foo')), 
     7    (r'^$','Bcfg2.Server.Reports.reports.views.index'), 
     8 
     9        (r'^clients/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$','Bcfg2.Server.Reports.reports.views.client_index'), 
     10    (r'^clients/(?P<hostname>\S+)/(?P<pk>\d+)/$', 'Bcfg2.Server.Reports.reports.views.client_detail'), 
     11    (r'^clients/(?P<hostname>\S+)/manage/$', 'Bcfg2.Server.Reports.reports.views.client_manage'), 
     12    (r'^clients/(?P<hostname>\S+)/$', 'Bcfg2.Server.Reports.reports.views.client_detail'), 
     13    (r'^clients/(?P<hostname>\S+)$', 'Bcfg2.Server.Reports.reports.views.client_detail'), 
     14                       #hack because hostnames have periods and we still want to append slash 
     15    (r'^clients/$','Bcfg2.Server.Reports.reports.views.client_index'), 
     16    (r'^displays/sys-view/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$','Bcfg2.Server.Reports.reports.views.display_sys_view'), 
     17    (r'^displays/sys-view/$','Bcfg2.Server.Reports.reports.views.display_sys_view'), 
     18    (r'^displays/summary/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$','Bcfg2.Server.Reports.reports.views.display_summary'), 
     19    (r'^displays/summary/$','Bcfg2.Server.Reports.reports.views.display_summary'), 
     20    (r'^displays/timing/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$','Bcfg2.Server.Reports.reports.views.display_timing'), 
     21    (r'^displays/timing/$','Bcfg2.Server.Reports.reports.views.display_timing'), 
     22    (r'^displays/$','Bcfg2.Server.Reports.reports.views.display_index'), 
     23 
     24    (r'^elements/modified/(?P<eyedee>\d+)/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$','Bcfg2.Server.Reports.reports.views.config_item_modified'), 
     25    (r'^elements/modified/(?P<eyedee>\d+)/$','Bcfg2.Server.Reports.reports.views.config_item_modified'), 
     26    (r'^elements/modified/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01]\ 
     27    [0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$','Bcfg2.Server.Reports.reports.views.modified_item_index'), 
     28    (r'^elements/modified/$','Bcfg2.Server.Reports.reports.views.modified_item_index'), 
     29    (r'^elements/bad/(?P<eyedee>\d+)/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$','Bcfg2.Server.Reports.reports.views.config_item_bad'), 
     30    (r'^elements/bad/(?P<eyedee>\d+)/$','Bcfg2.Server.Reports.reports.views.config_item_bad'), 
     31    (r'^elements/bad/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01]\ 
     32    [0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$','Bcfg2.Server.Reports.reports.views.bad_item_index'), 
     33    (r'^elements/bad/$','Bcfg2.Server.Reports.reports.views.bad_item_index') 
     34) 
     35 
     36    # Uncomment this for admin: 
     37    #(r'^admin/', include('django.contrib.admin.urls')), 
     38     
     39    #this is to debug directly from python 
     40if settings.DEBUG: 
     41    urlpatterns += patterns('', 
     42        (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', 
     43            {'document_root': '/usr/share/bcfg2/Reports/site_media'} 
     44        ), 
     45    ) 
     46 
     47## Uncomment this section if using authentication 
     48#urlpatterns += patterns('', 
     49#                        (r'^login/$', 'django.contrib.auth.views.login', 
     50#                         {'template_name': 'auth/login.html'}), 
     51#                        (r'^logout/$', 'django.contrib.auth.views.logout', 
     52#                         {'template_name': 'auth/logout.html'}) 
     53#                        ) 
  • bcfg2/src/lib/Server/Reports/urls.py

    diff --git a/bcfg2/src/lib/Server/Reports/urls.py b/bcfg2/src/lib/Server/Reports/urls.py
    index 836808c..28329c4 100644
    a b if c.has_option('statistics', 'web_prefix'): 
    1212    web_prefix_root = web_prefix 
    1313else: 
    1414    web_prefix = '' 
    15     web_prefix_root = '/' 
     15    web_prefix_root = '' 
    1616 
    1717urlpatterns = patterns('', 
    18     # Example: 
    19     # (r'^%sBcfg2.Server.Reports/' % web_prefix, include('Bcfg2.Server.Reports.apps.foo.urls.foo')), 
    20     (r'^%s*$' % web_prefix_root,'Bcfg2.Server.Reports.reports.views.index'), 
    21  
    22         (r'^%sclients/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.client_index'), 
    23     (r'^%sclients/(?P<hostname>\S+)/(?P<pk>\d+)/$' % web_prefix, 'Bcfg2.Server.Reports.reports.views.client_detail'), 
    24     (r'^%sclients/(?P<hostname>\S+)/manage/$' % web_prefix, 'Bcfg2.Server.Reports.reports.views.client_manage'), 
    25     (r'^%sclients/(?P<hostname>\S+)/$' % web_prefix, 'Bcfg2.Server.Reports.reports.views.client_detail'), 
    26     (r'^%sclients/(?P<hostname>\S+)$' % web_prefix, 'Bcfg2.Server.Reports.reports.views.client_detail'), 
    27                        #hack because hostnames have periods and we still want to append slash 
    28     (r'^%sclients/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.client_index'), 
    29     (r'^%sdisplays/sys-view/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.display_sys_view'), 
    30     (r'^%sdisplays/sys-view/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.display_sys_view'), 
    31     (r'^%sdisplays/summary/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.display_summary'), 
    32     (r'^%sdisplays/summary/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.display_summary'), 
    33     (r'^%sdisplays/timing/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.display_timing'), 
    34     (r'^%sdisplays/timing/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.display_timing'), 
    35     (r'^%sdisplays/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.display_index'), 
    36  
    37     (r'^%selements/modified/(?P<eyedee>\d+)/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.config_item_modified'), 
    38     (r'^%selements/modified/(?P<eyedee>\d+)/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.config_item_modified'), 
    39     (r'^%selements/modified/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01]\ 
    40     [0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.modified_item_index'), 
    41     (r'^%selements/modified/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.modified_item_index'), 
    42     (r'^%selements/bad/(?P<eyedee>\d+)/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01][0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.config_item_bad'), 
    43     (r'^%selements/bad/(?P<eyedee>\d+)/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.config_item_bad'), 
    44     (r'^%selements/bad/(?P<timestamp>(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])@([01]\ 
    45     [0-9]|2[0-3]):([0-5][0-9]|60):([0-5][0-9]|60))/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.bad_item_index'), 
    46     (r'^%selements/bad/$' % web_prefix,'Bcfg2.Server.Reports.reports.views.bad_item_index'), 
     18    (r'^%s' % web_prefix_root, include('Bcfg2.Server.Reports.reports.urls')), 
    4719) 
    48  
    49     # Uncomment this for admin: 
    50     #(r'^%sadmin/' % web_prefix, include('django.contrib.admin.urls')), 
    51  
    52  
    53 ## Uncomment this section if using authentication 
    54 #urlpatterns += patterns('', 
    55 #                        (r'^%slogin/$' % web_prefix, 'django.contrib.auth.views.login', 
    56 #                         {'template_name': 'auth/login.html'}), 
    57 #                        (r'^%slogout/$' % web_prefix, 'django.contrib.auth.views.logout', 
    58 #                         {'template_name': 'auth/logout.html'}) 
    59 #                        )