Code Duplication    Length = 23-23 lines in 2 locations

examples/pyramid_tut/pyramid_tut/views.py 2 locations

@@ 101-123 (lines=23) @@
98
    return rowTable.output_result()
99
100
101
@view_config(route_name="data_yadcf", renderer="json_with_dates")
102
def data_yadcf(request):
103
    """Return server side data."""
104
    columns = [
105
        ColumnDT(User.id, search_method="yadcf_range_number"),
106
        ColumnDT(User.name, search_method="yadcf_multi_select"),
107
        ColumnDT(Address.description, search_method="yadcf_autocomplete"),
108
        ColumnDT(User.birthday, search_method="yadcf_range_date"),
109
        ColumnDT(User.age, search_method="yadcf_range_number_slider")
110
    ]
111
112
    query = DBSession.query().select_from(User).join(Address).filter(
113
        Address.id > 4)
114
115
    rowTable = DataTables(request.GET, query, columns)
116
117
    return rowTable.output_result()
118
119
120
conn_err_msg = '''\
121
Pyramid is having a problem using your SQL database.  The problem
122
might be caused by one of the following things:
123
124
1.  You may need to run the "initialize_pyramid_tut_db" script
125
    to initialize your database tables.  Check your virtual
126
    environment's "bin" directory for this script and try to run it.
@@ 82-104 (lines=23) @@
79
    return rowTable.output_result()
80
81
82
@view_config(route_name="data_advanced", renderer="json_with_dates")
83
def data_advanced(request):
84
    """Return server side data."""
85
    columns = [
86
        ColumnDT(User.id, search_method="numeric"),
87
        ColumnDT(User.name),
88
        ColumnDT(Address.description),
89
        ColumnDT(User.birthday, search_method="date"),
90
        ColumnDT(User.age, search_method="numeric")
91
    ]
92
93
    query = DBSession.query().select_from(User).join(Address).filter(
94
        Address.id > 4)
95
96
    rowTable = DataTables(request.GET, query, columns)
97
98
    return rowTable.output_result()
99
100
101
@view_config(route_name="data_yadcf", renderer="json_with_dates")
102
def data_yadcf(request):
103
    """Return server side data."""
104
    columns = [
105
        ColumnDT(User.id, search_method="yadcf_range_number"),
106
        ColumnDT(User.name, search_method="yadcf_multi_select"),
107
        ColumnDT(Address.description, search_method="yadcf_autocomplete"),