GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — document-api-python/tableaudocumentapi/db_column.py at master · Bartman0/document-api-python

Expand file tree

/

db_column.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
42 lines (32 loc) · 1.25 KB
/

db_column.py

Copy path

File metadata and controls

42 lines (32 loc) · 1.25 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
_ATTRIBUTES = [
'key', # Name of the field as specified in the file, usually surrounded by [ ]
'value' # Name of the field as referred to in the database
]
class DBColumn(object):
""" Represents a DB column in a datasource """
def __init__(self, column_xml=None):
if column_xml is None:
raise AttributeError('column_xml needed to initialize field')
else:
self._initialize_from_column_xml(column_xml)
self._xml = column_xml
def _initialize_from_column_xml(self, xmldata):
for attrib in _ATTRIBUTES:
self._apply_attribute(xmldata, attrib, lambda x: xmldata.attrib.get(x, None))
def _apply_attribute(self, xmldata, attrib, default_func, read_name=None):
if read_name is None:
read_name = attrib
if hasattr(self, '_read_{}'.format(read_name)):
value = getattr(self, '_read_{}'.format(read_name))(xmldata)
else:
value = default_func(attrib)
setattr(self, '_{}'.format(attrib), value)
@property
def key(self):
return self._key
@property
def value(self):
return self._value
@classmethod
def from_column_xml(cls, xmldata):
return cls(column_xml=xmldata)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.