/usr/share/pyshared/sprox/iprovider.py is in python-sprox 0.6.4-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | """
iprovider Module
This contains the class which allows dbsprockets to interface with any database.
Copyright © 2008 Christopher Perkins
Original Version by Christopher Perkins 2008
Released under MIT license.
"""
class IProvider:
def get_field(self, entity, name):
"""Get a field with the given field name."""
raise NotImplementedError
def get_fields(self, entity):
"""Get all of the fields for a given entity."""
raise NotImplementedError
def get_entity(self, name):
"""Get an entity with the given name."""
raise NotImplementedError
def get_entities(self):
"""Get all entities available for this provider."""
raise NotImplementedError
def get_primary_fields(self, entity):
"""Get the fields in the entity which uniquely identifies a record."""
raise NotImplementedError
def get_primary_field(self, entity):
"""Get the single primary field for an entity"""
raise NotImplementedError
def get_view_field_name(self, entity, possible_names):
"""Get the name of the field which first matches the possible colums
:Arguments:
entity
the entity where the field is located
possible_names
a list of names which define what the view field may contain. This allows the first
field that has a name in the list of names will be returned as the view field.
"""
raise NotImplementedError
def get_dropdown_options(self, entity, field_name, view_names=None):
"""Get all dropdown options for a given entity field.
:Arguments:
entity
the entity where the field is located
field_name
name of the field in the entity
view_names
a list of names which define what the view field may contain. This allows the first
field that has a name in the list of names will be returned as the view field.
:Returns:
A list of tuples with (id, view_value) as items.
"""
raise NotImplementedError
def get_relations(self, entity):
"""Get all of the field names in an enity which are related to other entities."""
raise NotImplementedError
def is_relation(self, entity, field_name):
"""Determine if a field is related to a field in another entity."""
raise NotImplementedError
def is_nullable(self, entity, field_name):
"""Determine if a field is nullable."""
raise NotImplementedError
def get_default_values(self, entity, params):
"""Get the default values for form filling based on the database schema."""
raise NotImplementedError
def create(self, entity, params):
"""Create an entry of type entity with the given params."""
raise NotImplementedError
def get(self, entity, params):
"""Get a single entry of type entity which matches the params."""
raise NotImplementedError
def update(self, entity, params):
"""Update an entry of type entity which matches the params."""
raise NotImplementedError
def delete(self, entity, params):
"""Delete an entry of typeentity which matches the params."""
raise NotImplementedError
|