~maas-committers/maas/trunk

« back to all changes in this revision

Viewing changes to src/maasserver/api/support.py

  • Committer: MAAS Lander
  • Author(s): Gavin Panella, Lee Trager
  • Date: 2016-04-25 05:08:30 UTC
  • mfrom: (4942.2.2 delete_on_files)
  • Revision ID: maas_lander-20160425050830-8lbleappa0a3towo
[r=allenap][bug=1566108][author=ltrager] Allow deleting a file by specifying the filename as a parameter

Show diffs side-by-side

added added

removed removed

Lines of Context:
180
180
        exports.update(operations)
181
181
 
182
182
        # Check that no CRUD methods have been marked as operations (i.e.
183
 
        # those that are used via op=name). This causes weird behaviour within
184
 
        # Piston3 and/or Django so avoid it.
185
 
        for signature in OperationsResource.crudmap.items():
186
 
            if signature in exports:
 
183
        # those that are used via op=name). This causes (unconfirmed) weird
 
184
        # behaviour within Piston3 and/or Django, and is plain confusing
 
185
        # anyway, so forbid it.
 
186
        methods_exported = {method for http_method, method in exports}
 
187
        for http_method, method in OperationsResource.crudmap.items():
 
188
            if method in methods_exported:
187
189
                raise AssertionError(
188
 
                    "A CRUD operation (%s) has been registered as an "
189
 
                    "operation on %s." % ("%s/%s" % signature, name))
 
190
                    "A CRUD operation (%s/%s) has been registered as an "
 
191
                    "operation on %s." % (http_method, method, name))
190
192
 
191
193
        # Export CRUD methods.
192
194
        exports.update(crud)