File: module-sqlobject.boundattributes.html

package info (click to toggle)
sqlobject 3.1.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 9,280 kB
  • ctags: 17,912
  • sloc: python: 16,713; sh: 18; makefile: 13
file content (122 lines) | stat: -rw-r--r-- 4,741 bytes parent folder | download
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

  <h1 class="pudge-member-page-heading">
    <tt>boundattributes</tt>
  </h1>
  <h4 class="pudge-member-page-subheading">
    Bound attributes are attributes that are bound to a specific class and
a specific name.  In SQLObject a typical example is a column object,
which knows its name and class.
  </h4>
  <p class="pudge-member-parent-link">
    <small>
    The boundattributes module is accessible via the
    <a href="module-sqlobject.html">
      <tt>sqlobject</tt>
    </a> module.
    </small>
  </p>
  <div id="pudge-section-nav">
  <ul>
    <li>
      <a href="#attributes" class="pudge-section-link">
        Attributes (1)
      </a>
    </li><li>
      <span class="pudge-missing-section-link">
        Functions
      </span>
    </li><li>
      <a href="#classes" class="pudge-section-link">
        Classes (2)
      </a>
    </li><li>
      <span class="pudge-missing-section-link">
        Modules
      </span>
    </li>
    <li>
      <a href="module-sqlobject.boundattributes-index.html" class="pudge-section-link">
        Index
      </a>
    </li>
    <li>
      <a href="sqlobject/boundattributes.py.html" class="pudge-section-link">
        Source
      </a>
    </li>
  </ul>
  </div>
  <div style="clear: left"></div>
  <div class="rst pudge-module-doc">
    <p>A bound attribute should define a method <tt class="docutils literal">__addtoclass__(added_class,
name)</tt> (attributes without this method will simply be treated as
normal).  The return value is ignored; if the attribute wishes to
change the value in the class, it must call <tt class="docutils literal">setattr(added_class,
name, new_value)</tt>.</p>
<p>BoundAttribute is a class that facilitates lazy attribute creation.</p>
  </div>
  <hr>
    <a name="attributes"></a>
    <h2>Attributes</h2>
    <div class="pudge-member name">
    <a name="__package__"></a>
    <h4 class="pudge-member-name"><span class="prefix">a</span>
      <tt><a href="module-sqlobject.boundattributes.html#__package__" class="pudge-obj-link">__package__</a></tt></h4>
    <div class="pudge-section rst">
      <pre>'sqlobject'</pre>
    </div>
  </div>
    <a name="classes"></a>
    <h2>Classes</h2>
    <div class="pudge-member class ">
    <h4 class="pudge-member-name"><span class="prefix">C</span>
      <tt>
        <a href="class-sqlobject.boundattributes.BoundAttribute.html" class="pudge-obj-link">BoundAttribute</a>(...)</tt>
      <a href="sqlobject/boundattributes.py.html?f=22&amp;l=106#22" class="pudge-member-view-source" title="View Source">...</a>
    </h4>
    <div class="pudge-section rst">
    <p class="pudge-member-blurb">
      This is a declarative class that passes all the values given to it
to another object.  So you can pass it arguments (via
__init__/__call__) or give it the equivalent of keyword arguments
through subclassing.  Then a bound object will be added in its
place.
    </p>
    <p>To hook this other object in, override <tt class="docutils literal">make_object(added_class,
name, **attrs)</tt> and maybe <tt class="docutils literal">set_object(added_class, name,
**attrs)</tt> (the default implementation of <tt class="docutils literal">set_object</tt>
just resets the attribute to whatever <tt class="docutils literal">make_object</tt> returned).</p>
<p>Also see <tt class="docutils literal">BoundFactory</tt>.</p>
      <p class="note">
        This class contains <a href="class-sqlobject.boundattributes.BoundAttribute.html#members">
          16 members</a>.
      </p>
    </div>
  </div><div class="pudge-member class ">
    <h4 class="pudge-member-name"><span class="prefix">C</span>
      <tt>
        <a href="class-sqlobject.boundattributes.BoundFactory.html" class="pudge-obj-link">BoundFactory</a>(...)</tt>
      <a href="sqlobject/boundattributes.py.html?f=108&amp;l=125#108" class="pudge-member-view-source" title="View Source">...</a>
    </h4>
    <div class="pudge-section rst">
    <p class="pudge-member-blurb">
      This will bind the attribute to whatever is given by
<tt class="docutils literal">factory_class</tt>.  This factory should be a callable with the
signature <tt class="docutils literal">factory_class(added_class, attr_name, *args, **kw)</tt>.
    </p>
    <p>The factory will be reinvoked (and the attribute rebound) for
every subclassing.</p>
      <p class="note">
        This class contains <a href="class-sqlobject.boundattributes.BoundFactory.html#members">
          17 members</a>.
      </p>
    </div>
  </div>
  <p>
    <small>
    See 
    <a href="sqlobject/boundattributes.py.html" title="sqlobject/boundattributes.py:0">the source</a>
    for more information.
    </small>
  </p>