tclhttpd

Check-in [001675d4e9]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Adding markdown documentation into the source repo
Timelines: family | ancestors | descendants | both | 4_0
Files: files | file ages | folders
SHA1:001675d4e90559ef6561c9bbe63d6983fdbf8636
User & Date: hypnotoad 2015-04-02 15:43:38
Context
2015-04-03
07:35
Added more documentation Renamed the cookieSet method to httpdCookieSet, and moved it to httpd.meta Moved httpdHostName it to httpd.meta Implemented logins using encrypted password hashes Added a module to store javascript password hashing routines. Added a "cat" command to dump files Added the pageHeader and pageFooter methods to httpd.meta Community and its decendents now render pages in bootstrap/jquery. Added jquery to our bootstrap distribution check-in: 80751cdeac user: hypnotoad tags: 4_0
2015-04-02
21:14
Added doccos check-in: 91370c635c user: hypnotoad tags: private
15:43
Adding markdown documentation into the source repo check-in: 001675d4e9 user: hypnotoad tags: 4_0
10:30
Added the tao-sqlite module check-in: 4c9c257145 user: hypnotoad tags: 4_0
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to modules/community/community.md.

1
2
3
4
5
6
7
8
9
10





11
12
13
14
15
16
17
18
19


*httpd.community* is a decendent of [httpd.taourl](wiki?taourl). It adds an sqlite based user, group, and access control system. It is implemented in [community.tcl](finfo?name=modules/community/community.tcl).

## Required Packages

Community relies on the following external packages:

* tao-sqlite from [taolib](http://fossil.etoyoc.com/fossil/taolib)
* sha1 from [tcllib](http://core.tcl.tk/tcllib)
* sqlite3 from [sqlite](http://www.sqlite.org)







## Options

* dbfile - Path to a file which stores the sqlite database for the community (default in-memory)
* virtual - Root Url of this object.

## Attached Objects

Community objects (and their derived classes) contain an embedded sqlite database. This database can be accessed via that \<db\> method.








<



>
>
>
>
>








|
>
>
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
*httpd.community* is a decendent of [httpd.taourl](wiki?taourl). It adds an sqlite based user, group, and access control system. It is implemented in [community.tcl](finfo?name=modules/community/community.tcl).

## Required Packages

Community relies on the following external packages:


* sha1 from [tcllib](http://core.tcl.tk/tcllib)
* sqlite3 from [sqlite](http://www.sqlite.org)

Community uses the following internal packages:

* tao from [tao](../tao/tao.md)
* tao-sqlite [tao-sqlite](../tao-sqlite/tao-sqlite.md)


## Options

* dbfile - Path to a file which stores the sqlite database for the community (default in-memory)
* virtual - Root Url of this object.

## Attached Objects

Community objects (and their derived classes) contain an embedded sqlite
database. This database can be accessed via that \<db\> method.

Changes to modules/directoo/taourl.md.











>
>
>
>
>
1
2
3
4
5
*httpd.taourl* is an implementation of [httpd.url](wiki?name=DirectOO) in the [Tao](../tao.md) framework. Tao offers enhanced 
option handling and a system for tracking properties of classes and object.

*httpd.taourl* has the all of the same methods and variables as [httpd.url](directoo.md), with additional methods provided 
by the Tao framework.

Added modules/tao/events.md.

Added modules/tao/moac.md.















































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# Class tao::moac

All classes in the Tao framework decend from tao::moac.

# Concepts

Back to [tao](tao.md)

* [taodb](taodb.md)
* [events](events.md)
* [options](options.md)
* [parser](parser.md)
* [signals](signals.md)

# Options

* trace - When true, enable tracing information to stdout

# Properties

* options_strict - Default 0. When true, attempts to access an option through configure
or cget, which was not declared by the *option* keyword, or inherited from another class, will fail.

# Variables

* ActiveLocks - A list of active locks
* organs - A dict containing the mapping of stubs to objects

# Methods

## action::busy

Indicate to the user that the program is processing. (Empty method)

## action::idle

Commands to run when the system releases the gui. (Empty method)

## action::morph_enter

Commands to perform as an object enters this new class via the *morph* method. (Empty method)

## action::morph_leave

Commands to perform as an object exits the current class via the *morph* method. (Empty method)

## action::pipeline_busy

Commands to run when the system releases the locks. (Empty method)

** method cget *field* *?default?*

Return the value for an option, or of the option is null return *default*.
Dashes are stripped from the left of all fields.

** method code

Return \[namespace code {self}\]

## method configure *keyvaluelist*|*key* *value* ?*key* *value*...

Modify options. The command accepts either a single argument (a key value list), or
a series of keys. Dashes are stripped from the left of all fields.

Internally, *configure* normalizes the inputs, and passes them to *configurelist* and
*configurelist_triggers*.

## method configurelist *keyvaluelist*

Perform validation checks and modify the internal configuration of the
object. This method will not trigger modification events.

## method event cancel ?*pattern*?

Cancel a scheduled event. If *pattern* not specified, all scheduled tasks are
cancelled. If *pattern* given, all task handles that match *pattern* are cancelled.
Patterns are those used by *array get*.

(Note: this method is actually a forward to ::tao::event::cancel)

## method event generate *event* *args...*

Generate an event of type *event* which will be passed to the *notify* method
of all objects subscribed to *event*.

(Note: this method is actually a forward to ::tao::event::generate)

## method event nextid

Return a unique name for an event.

## method event Notification_list *pattern*

Called recursively to produce a list of who recieves notifications of pattern *pattern*.

(Note: this method is actually a forward to ::tao::event::Notification\_list)

## method event publish *object_pattern* *event_pattern*

Create a subscription for objects specified by *object_pattern* to events specified by *event_pattern*.
Patterns should be any pattern suitiable for \[string match\]

## method event schedule *handle* *interval* *script*

Arrange for *script* to be called after *interval*. Interval is any value acceptable to
\[after\]. A successive call to *handle* will cancel the prior event and schedule a new one.

## method event subscribe *object_pattern* *event_pattern*

Create a subscription for the current object to events emitted by objects
specified by *object_pattern* to events specified by *event_pattern*.
Patterns should be any pattern suitiable for \[string match\]

## method event unpublish *?event_pattern?*

Remove any subscriptions to this object's events that match *event_pattern*. If *event_pattern*
not given, all subscriptions are removed.

## method event unsubscribe *?event_pattern?*

Remove any subscriptions this object has made to events that match *event_pattern*. If *event_pattern*
not given, all subscriptions are removed.

## method forward *method* *?args...?*

Forward *method* to the command specified by *args*. Internally this is just a
wrapper around \[oo::objdefine forward\]

## method graft *stub* *object* ?*stub* *object*...?

Calles to \<*stub*\> for this object will now forward to the *object* (or ensemble)
specified. A mapping of stub->object is stored internally as a dict in the *organs* variable.

## method initialize

Called during the constructor to
set up all local variables and data
structures. It is a seperate method
to ensure inheritence chains predictably
and also to keep us from having to pass
along the constructor's arguments.

## method InitializePublic

Provide a default value for all options and
publically declared variables, and locks the
pipeline mutex to prevent signal processing
while the contructor is still running. A call to
this method is automatically injected into the constructor
by the Tao preprocessor's *constructor* keyword.

Note, by default a Tao object will ignore
signals until a later call to *my lock remove pipeline*

## method lock active

Return a list of active locks.

## method lock create *lock* ?*lock*...?

Add all arguments as locks if they are not already in the list of locks.

## method lock peek *lock* ?*lock*...?

Returns true if any of the locks specified is active.

## method lock remove *lock* ?*lock*...?

Remove the locks specified. If the last lock has been removed, a call to
*lock remove_all* is made.

## method lock remove_all

Removes all locks and makes a call to *Signal_pipeline*

## method message error *error* *errorInfo*

Process a background error

## method morph *newclass*

Have this object transition to *newclass* (if it isn't already that class).

The following snippet describes the steps:

      # CALLED AS THE PRESENT CLASS
      my action morph_leave
      oo::objdefine [self] class ::${newclass}
      # CALLED AS THE NEW CLASS
      my variable config
      set savestate $config
      my InitializePublic
      my configurelist $savestate
      my action morph_enter
    
The InitializePublic call ensures that any internal variables and options
that are declared in the new class, but not present in the current class,
are initialized.

## method mutex down *flag*

Remove mutex *flag*. Return 1 if the mutex was active, 0 otherwise.

## method mutex peek *flag*

Return 1 if mutex *flag* is active, 0 otherwise.

## method mutex up *flag*

Attempt to establish a mutex *flag*. If mutex is already active, return 1.
If a new mutex was successfully established, return 0.

## Ensemble notify *eventtype* *info*

Process an incoming notification of *eventtime* immediately.

## Ensemble Option_set *field* *newvalue*

Called by *configurelist_triggers*

Process and incoming change to an option.

## method OptionsMirrored *stub*

Return a list of options which should be mirrored to an object attached as \<*stub*\>.

## method organ *?stub?*

Return the path to the object attached as \<*stub*\>. If stub not given, return a key/value
list of all stubs and objects.

## method Prefs_Load

Load persistant preferences for this object. (Empty method)

## method Prefs_Store dictargs

Store persistant preferences for this object. (Empty method)

## method private *method* ?*args...*?

Invoke a normally private method publically.

## method signal ?*signal* *signal...*?

Generate a signal, which will ultimately schedule a call to *Signal_pipeline*. The call
of one signal can trigger or suppress other signals. See [signals](signals.md)

Changes to modules/tao/moac.tcl.

1
2
3
4
5

6
7
8
9
10
11
12
#oo::define oo::class {
#  destructor {
#    ::tao::class_destroy [self]
#  }
#}

if {[info command ::tao::metaclass] eq {}} {
  oo::class create ::tao::metaclass {
    superclass ::oo::class
    
    destructor {
      ::tao::class_destroy [self]
    }
<
<
<
<
<
>












1
2
3
4
5
6
7
8






if {[info command ::tao::metaclass] eq {}} {
  oo::class create ::tao::metaclass {
    superclass ::oo::class
    
    destructor {
      ::tao::class_destroy [self]
    }

Added modules/tao/options.md.

Added modules/tao/parser.md.

Added modules/tao/signals.md.

Changes to modules/tao/tao.md.



























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
The Tao package is a framework built on top of TclOO. Classes and objects
created in Tao are 100% compadible with standard TclOO.

Tao adds a host of features that is not available in vanilla TclOO
They include the following:

* [events](events.md)
* [options](options.md)
* [moac](moac.md)
* [parser](parser.md)
* [signals](signals.md)
* [taodb](taodb.md)

# Development

Tao is maintained at <http://fossil.etoyoc.com/fossil/taolib>.
If you are viewing this file from within tclhttpd's sources, you are
viewing a snapshot that is periodically updated from the mainstream
sources.

Tao was built, designed, and maintained by Sean Woods <yoda@etoyoc.com>.

# Major Concepts

* All tao framework objects decend from the [Mother of all Classes](moac.md)
* Tao classes are built using the *::tao::class* keyword, instead of *::oo::class create*
* Tao classes can be modified using the *::tao::class* keyword, instead of *::oo::define*
* A method in \<brackets\> indicates that the method is actually being forwarded to another object.
* *::tao::class* is a pre-parser, which adds additional keywords and modifies the behavior of the constructor and destructor

Added modules/tao/taodb.md.