]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Python/Python-2.7.2/Tools/faqwiz/faqconf.py
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Tools / faqwiz / faqconf.py
CommitLineData
4710c53d 1"""FAQ Wizard customization module.\r
2\r
3Edit this file to customize the FAQ Wizard. For normal purposes, you\r
4should only have to change the FAQ section titles and the small group\r
5of parameters below it.\r
6\r
7"""\r
8\r
9# Titles of FAQ sections\r
10\r
11SECTION_TITLES = {\r
12 # SectionNumber : SectionTitle; need at least one entry\r
13 1: "General information and availability",\r
14}\r
15\r
16# Parameters you definitely want to change\r
17\r
18SHORTNAME = "Generic" # FAQ name with "FAQ" omitted\r
19PASSWORD = "" # Password for editing\r
20OWNERNAME = "FAQ owner" # Name for feedback\r
21OWNEREMAIL = "nobody@anywhere.org" # Email for feedback\r
22HOMEURL = "http://www.python.org" # Related home page\r
23HOMENAME = "Python home" # Name of related home page\r
24RCSBINDIR = "/usr/local/bin/" # Directory containing RCS commands\r
25 # (must end in a slash)\r
26\r
27# Parameters you can normally leave alone\r
28\r
29MAXHITS = 10 # Max #hits to be shown directly\r
30COOKIE_LIFETIME = 28*24*3600 # Cookie expiration in seconds\r
31 # (28*24*3600 = 28 days = 4 weeks)\r
32PROCESS_PREFORMAT = 1 # toggle whether preformatted text\r
33 # will replace urls and emails with\r
34 # HTML links\r
35\r
36# Markers appended to title to indicate recently change\r
37# (may contain HTML, e.g. <IMG>); and corresponding\r
38\r
39MARK_VERY_RECENT = " **" # Changed very recently\r
40MARK_RECENT = " *" # Changed recently\r
41DT_VERY_RECENT = 24*3600 # 24 hours\r
42DT_RECENT = 7*24*3600 # 7 days\r
43\r
44EXPLAIN_MARKS = """\r
45<P>(Entries marked with ** were changed within the last 24 hours;\r
46entries marked with * were changed within the last 7 days.)\r
47<P>\r
48"""\r
49\r
50# Version -- don't change unless you edit faqwiz.py\r
51\r
52WIZVERSION = "1.0.4" # FAQ Wizard version\r
53\r
54import os, sys\r
55if os.name in ['nt',]:\r
56 # On NT we'll probably be running python from a batch file,\r
57 # so sys.argv[0] is not helpful\r
58 FAQCGI = 'faq.bat' # Relative URL of the FAQ cgi script\r
59 # LOGNAME is not typically set on NT\r
60 os.environ[ 'LOGNAME' ] = "FAQWizard"\r
61else:\r
62 # This parameter is normally overwritten with a dynamic value\r
63 FAQCGI = 'faqw.py' # Relative URL of the FAQ cgi script\r
64 FAQCGI = os.path.basename(sys.argv[0]) or FAQCGI\r
65del os, sys\r
66\r
67# Perl (re module) style regular expression to recognize FAQ entry\r
68# files: group(1) should be the section number, group(2) should be the\r
69# question number. Both should be fixed width so simple-minded\r
70# sorting yields the right order.\r
71\r
72OKFILENAME = r"^faq(\d\d)\.(\d\d\d)\.htp$"\r
73\r
74# Format to construct a FAQ entry file name\r
75\r
76NEWFILENAME = "faq%02d.%03d.htp"\r
77\r
78# Load local customizations on top of the previous parameters\r
79\r
80try:\r
81 from faqcust import *\r
82except ImportError:\r
83 pass\r
84\r
85# Calculated parameter names\r
86\r
87COOKIE_NAME = SHORTNAME + "-FAQ-Wizard" # Name used for Netscape cookie\r
88FAQNAME = SHORTNAME + " FAQ" # Name of the FAQ\r
89\r
90# ----------------------------------------------------------------------\r
91\r
92# Anything below this point normally needn't be changed; you would\r
93# change this if you were to create e.g. a French translation or if\r
94# you just aren't happy with the text generated by the FAQ Wizard.\r
95\r
96# Most strings here are subject to substitution (string%dictionary)\r
97\r
98# RCS commands\r
99\r
100import os\r
101if os.name in ['nt', ]:\r
102 SH_RLOG = RCSBINDIR + "rlog %(file)s < NUL"\r
103 SH_RLOG_H = RCSBINDIR + "rlog -h %(file)s < NUL"\r
104 SH_RDIFF = RCSBINDIR + "rcsdiff -r%(prev)s -r%(rev)s %(file)s < NUL"\r
105 SH_REVISION = RCSBINDIR + "co -p%(rev)s %(file)s < NUL"\r
106 ### Have to use co -l, or the file is not marked rw on NT\r
107 SH_LOCK = RCSBINDIR + "co -l %(file)s < NUL"\r
108 SH_CHECKIN = RCSBINDIR + "ci -u %(file)s < %(tfn)s"\r
109else:\r
110 SH_RLOG = RCSBINDIR + "rlog %(file)s </dev/null 2>&1"\r
111 SH_RLOG_H = RCSBINDIR + "rlog -h %(file)s </dev/null 2>&1"\r
112 SH_RDIFF = RCSBINDIR + "rcsdiff -r%(prev)s -r%(rev)s %(file)s </dev/null 2>&1"\r
113 SH_REVISION = RCSBINDIR + "co -p%(rev)s %(file)s </dev/null 2>&1"\r
114 SH_LOCK = RCSBINDIR + "rcs -l %(file)s </dev/null 2>&1"\r
115 SH_CHECKIN = RCSBINDIR + "ci -u %(file)s <%(tfn)s 2>&1"\r
116del os\r
117\r
118# Titles for various output pages (not subject to substitution)\r
119\r
120T_HOME = FAQNAME + " Wizard " + WIZVERSION\r
121T_ERROR = "Sorry, an error occurred"\r
122T_ROULETTE = FAQNAME + " Roulette"\r
123T_ALL = "The Whole " + FAQNAME\r
124T_INDEX = FAQNAME + " Index"\r
125T_SEARCH = FAQNAME + " Search Results"\r
126T_RECENT = "What's New in the " + FAQNAME\r
127T_SHOW = FAQNAME + " Entry"\r
128T_LOG = "RCS log for %s entry" % FAQNAME\r
129T_REVISION = "RCS revision for %s entry" % FAQNAME\r
130T_DIFF = "RCS diff for %s entry" % FAQNAME\r
131T_ADD = "Add an entry to the " + FAQNAME\r
132T_DELETE = "Deleting an entry from the " + FAQNAME\r
133T_EDIT = FAQNAME + " Edit Wizard"\r
134T_REVIEW = T_EDIT + " - Review Changes"\r
135T_COMMITTED = T_EDIT + " - Changes Committed"\r
136T_COMMITFAILED = T_EDIT + " - Commit Failed"\r
137T_CANTCOMMIT = T_EDIT + " - Commit Rejected"\r
138T_HELP = T_EDIT + " - Help"\r
139\r
140# Generic prologue and epilogue\r
141\r
142PROLOGUE = '''\r
143<HTML>\r
144<HEAD>\r
145<TITLE>%(title)s</TITLE>\r
146</HEAD>\r
147\r
148<BODY\r
149 BGCOLOR="#FFFFFF"\r
150 TEXT="#000000"\r
151 LINK="#AA0000"\r
152 VLINK="#906A6A">\r
153<H1>%(title)s</H1>\r
154'''\r
155\r
156EPILOGUE = '''\r
157<HR>\r
158<A HREF="%(HOMEURL)s">%(HOMENAME)s</A> /\r
159<A HREF="%(FAQCGI)s?req=home">%(FAQNAME)s Wizard %(WIZVERSION)s</A> /\r
160Feedback to <A HREF="mailto:%(OWNEREMAIL)s">%(OWNERNAME)s</A>\r
161\r
162</BODY>\r
163</HTML>\r
164'''\r
165\r
166# Home page\r
167\r
168HOME = """\r
169<H2>Search the %(FAQNAME)s:</H2>\r
170\r
171<BLOCKQUOTE>\r
172\r
173<FORM ACTION="%(FAQCGI)s">\r
174 <INPUT TYPE=text NAME=query>\r
175 <INPUT TYPE=submit VALUE="Search"><BR>\r
176 <INPUT TYPE=radio NAME=querytype VALUE=simple CHECKED>\r
177 Simple string\r
178 /\r
179 <INPUT TYPE=radio NAME=querytype VALUE=regex>\r
180 Regular expression\r
181 /<BR>\r
182 <INPUT TYPE=radio NAME=querytype VALUE=anykeywords>\r
183 Keywords (any)\r
184 /\r
185 <INPUT TYPE=radio NAME=querytype VALUE=allkeywords>\r
186 Keywords (all)\r
187 <BR>\r
188 <INPUT TYPE=radio NAME=casefold VALUE=yes CHECKED>\r
189 Fold case\r
190 /\r
191 <INPUT TYPE=radio NAME=casefold VALUE=no>\r
192 Case sensitive\r
193 <BR>\r
194 <INPUT TYPE=hidden NAME=req VALUE=search>\r
195</FORM>\r
196\r
197</BLOCKQUOTE>\r
198\r
199<HR>\r
200\r
201<H2>Other forms of %(FAQNAME)s access:</H2>\r
202\r
203<UL>\r
204<LI><A HREF="%(FAQCGI)s?req=index">FAQ index</A>\r
205<LI><A HREF="%(FAQCGI)s?req=all">The whole FAQ</A>\r
206<LI><A HREF="%(FAQCGI)s?req=recent">What's new in the FAQ?</A>\r
207<LI><A HREF="%(FAQCGI)s?req=roulette">FAQ roulette</A>\r
208<LI><A HREF="%(FAQCGI)s?req=add">Add a FAQ entry</A>\r
209<LI><A HREF="%(FAQCGI)s?req=delete">Delete a FAQ entry</A>\r
210</UL>\r
211"""\r
212\r
213# Index formatting\r
214\r
215INDEX_SECTION = """\r
216<P>\r
217<HR>\r
218<H2>%(sec)s. %(title)s</H2>\r
219<UL>\r
220"""\r
221\r
222INDEX_ADDSECTION = """\r
223<P>\r
224<LI><A HREF="%(FAQCGI)s?req=new&amp;section=%(sec)s">Add new entry</A>\r
225(at this point)\r
226"""\r
227\r
228INDEX_ENDSECTION = """\r
229</UL>\r
230"""\r
231\r
232INDEX_ENTRY = """\\r
233<LI><A HREF="%(FAQCGI)s?req=show&amp;file=%(file)s">%(title)s</A>\r
234"""\r
235\r
236LOCAL_ENTRY = """\\r
237<LI><A HREF="#%(sec)s.%(num)s">%(title)s</A>\r
238"""\r
239\r
240# Entry formatting\r
241\r
242ENTRY_HEADER1 = """\r
243<HR>\r
244<H2><A NAME="%(sec)s.%(num)s">%(title)s</A>\\r
245"""\r
246\r
247ENTRY_HEADER2 = """\\r
248</H2>\r
249"""\r
250\r
251ENTRY_FOOTER = """\r
252<A HREF="%(FAQCGI)s?req=edit&amp;file=%(file)s">Edit this entry</A> /\r
253<A HREF="%(FAQCGI)s?req=log&amp;file=%(file)s">Log info</A>\r
254"""\r
255\r
256ENTRY_LOGINFO = """\r
257/ Last changed on %(last_changed_date)s by\r
258<A HREF="mailto:%(last_changed_email)s">%(last_changed_author)s</A>\r
259"""\r
260\r
261# Search\r
262\r
263NO_HITS = """\r
264No hits.\r
265"""\r
266\r
267ONE_HIT = """\r
268Your search matched the following entry:\r
269"""\r
270\r
271FEW_HITS = """\r
272Your search matched the following %(count)s entries:\r
273"""\r
274\r
275MANY_HITS = """\r
276Your search matched more than %(MAXHITS)s entries.\r
277The %(count)s matching entries are presented here ordered by section:\r
278"""\r
279\r
280# RCS log and diff\r
281\r
282LOG = """\r
283Click on a revision line to see the diff between that revision and the\r
284previous one.\r
285"""\r
286\r
287REVISIONLINK = """\\r
288<A HREF="%(FAQCGI)s?req=revision&amp;file=%(file)s&amp;rev=%(rev)s"\r
289>%(line)s</A>\\r
290"""\r
291DIFFLINK = """\\r
292 (<A HREF="%(FAQCGI)s?req=diff&amp;file=%(file)s&amp;\\r
293prev=%(prev)s&amp;rev=%(rev)s"\r
294>diff -r%(prev)s -r%(rev)s</A>)\\r
295"""\r
296\r
297# Recently changed entries\r
298\r
299NO_RECENT = """\r
300<HR>\r
301No %(FAQNAME)s entries were changed in the last %(period)s.\r
302"""\r
303\r
304VIEW_MENU = """\r
305<HR>\r
306View entries changed in the last...\r
307<UL>\r
308<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=1">24 hours</A>\r
309<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=2">2 days</A>\r
310<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=3">3 days</A>\r
311<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=7">week</A>\r
312<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=28">4 weeks</A>\r
313<LI><A HREF="%(FAQCGI)s?req=recent&amp;days=365250">millennium</A>\r
314</UL>\r
315"""\r
316\r
317ONE_RECENT = VIEW_MENU + """\r
318The following %(FAQNAME)s entry was changed in the last %(period)s:\r
319"""\r
320\r
321SOME_RECENT = VIEW_MENU + """\r
322The following %(count)s %(FAQNAME)s entries were changed\r
323in the last %(period)s, most recently changed shown first:\r
324"""\r
325\r
326TAIL_RECENT = VIEW_MENU\r
327\r
328# Last changed banner on "all" (strftime format)\r
329LAST_CHANGED = "Last changed on %c %Z"\r
330\r
331# "Compat" command prologue (this has no <BODY> tag)\r
332COMPAT = """\r
333<H1>The whole %(FAQNAME)s</H1>\r
334See also the <A HREF="%(FAQCGI)s?req=home">%(FAQNAME)s Wizard</A>.\r
335<P>\r
336"""\r
337\r
338# Editing\r
339\r
340EDITHEAD = """\r
341<A HREF="%(FAQCGI)s?req=help">Click for Help</A>\r
342"""\r
343\r
344REVIEWHEAD = EDITHEAD\r
345\r
346\r
347EDITFORM1 = """\r
348<FORM ACTION="%(FAQCGI)s" METHOD=POST>\r
349<INPUT TYPE=hidden NAME=req VALUE=review>\r
350<INPUT TYPE=hidden NAME=file VALUE=%(file)s>\r
351<INPUT TYPE=hidden NAME=editversion VALUE=%(editversion)s>\r
352<HR>\r
353"""\r
354\r
355EDITFORM2 = """\r
356Title: <INPUT TYPE=text SIZE=70 NAME=title VALUE="%(title)s"><BR>\r
357<TEXTAREA COLS=72 ROWS=20 NAME=body>%(body)s\r
358</TEXTAREA><BR>\r
359Log message (reason for the change):<BR>\r
360<TEXTAREA COLS=72 ROWS=5 NAME=log>%(log)s\r
361</TEXTAREA><BR>\r
362Please provide the following information for logging purposes:\r
363<TABLE FRAME=none COLS=2>\r
364 <TR>\r
365 <TD>Name:\r
366 <TD><INPUT TYPE=text SIZE=40 NAME=author VALUE="%(author)s">\r
367 <TR>\r
368 <TD>Email:\r
369 <TD><INPUT TYPE=text SIZE=40 NAME=email VALUE="%(email)s">\r
370 <TR>\r
371 <TD>Password:\r
372 <TD><INPUT TYPE=password SIZE=20 NAME=password VALUE="%(password)s">\r
373</TABLE>\r
374\r
375<INPUT TYPE=submit NAME=review VALUE="Preview Edit">\r
376Click this button to preview your changes.\r
377"""\r
378\r
379EDITFORM3 = """\r
380</FORM>\r
381"""\r
382\r
383COMMIT = """\r
384<INPUT TYPE=submit NAME=commit VALUE="Commit">\r
385Click this button to commit your changes.\r
386<HR>\r
387"""\r
388\r
389NOCOMMIT_HEAD = """\r
390To commit your changes, please correct the following errors in the\r
391form below and click the Preview Edit button.\r
392<UL>\r
393"""\r
394NOCOMMIT_TAIL = """\r
395</UL>\r
396<HR>\r
397"""\r
398\r
399CANTCOMMIT_HEAD = """\r
400Some required information is missing:\r
401<UL>\r
402"""\r
403NEED_PASSWD = "<LI>You must provide the correct password.\n"\r
404NEED_AUTHOR = "<LI>You must enter your name.\n"\r
405NEED_EMAIL = "<LI>You must enter your email address.\n"\r
406NEED_LOG = "<LI>You must enter a log message.\n"\r
407CANTCOMMIT_TAIL = """\r
408</UL>\r
409Please use your browser's Back command to correct the form and commit\r
410again.\r
411"""\r
412\r
413NEWCONFLICT = """\r
414<P>\r
415You are creating a new entry, but the entry number specified is not\r
416correct.\r
417<P>\r
418The two most common causes of this problem are:\r
419<UL>\r
420<LI>After creating the entry yourself, you went back in your browser,\r
421 edited the entry some more, and clicked Commit again.\r
422<LI>Someone else started creating a new entry in the same section and\r
423 committed before you did.\r
424</UL>\r
425(It is also possible that the last entry in the section was physically\r
426deleted, but this should not happen except through manual intervention\r
427by the FAQ maintainer.)\r
428<P>\r
429<A HREF="%(FAQCGI)s?req=new&amp;section=%(sec)s">Click here to try\r
430again.</A>\r
431<P>\r
432"""\r
433\r
434VERSIONCONFLICT = """\r
435<P>\r
436You edited version %(editversion)s but the current version is %(version)s.\r
437<P>\r
438The two most common causes of this problem are:\r
439<UL>\r
440<LI>After committing a change, you went back in your browser,\r
441 edited the entry some more, and clicked Commit again.\r
442<LI>Someone else started editing the same entry and committed\r
443 before you did.\r
444</UL>\r
445<P>\r
446<A HREF="%(FAQCGI)s?req=show&amp;file=%(file)s">Click here to reload\r
447the entry and try again.</A>\r
448<P>\r
449"""\r
450\r
451CANTWRITE = """\r
452Can't write file %(file)s (%(why)s).\r
453"""\r
454\r
455FILEHEADER = """\\r
456Title: %(title)s\r
457Last-Changed-Date: %(date)s\r
458Last-Changed-Author: %(author)s\r
459Last-Changed-Email: %(email)s\r
460Last-Changed-Remote-Host: %(REMOTE_HOST)s\r
461Last-Changed-Remote-Address: %(REMOTE_ADDR)s\r
462"""\r
463\r
464LOGHEADER = """\\r
465Last-Changed-Date: %(date)s\r
466Last-Changed-Author: %(author)s\r
467Last-Changed-Email: %(email)s\r
468Last-Changed-Remote-Host: %(REMOTE_HOST)s\r
469Last-Changed-Remote-Address: %(REMOTE_ADDR)s\r
470\r
471%(log)s\r
472"""\r
473\r
474COMMITTED = """\r
475Your changes have been committed.\r
476"""\r
477\r
478COMMITFAILED = """\r
479Exit status %(sts)s.\r
480"""\r
481\r
482# Add/Delete\r
483\r
484ADD_HEAD = """\r
485At the moment, new entries can only be added at the end of a section.\r
486This is because the entry numbers are also their\r
487unique identifiers -- it's a bad idea to renumber entries.\r
488<P>\r
489Click on the section to which you want to add a new entry:\r
490<UL>\r
491"""\r
492\r
493ADD_SECTION = """\\r
494<LI><A HREF="%(FAQCGI)s?req=new&amp;section=%(section)s">%(section)s. %(title)s</A>\r
495"""\r
496\r
497ADD_TAIL = """\r
498</UL>\r
499"""\r
500\r
501ROULETTE = """\r
502<P>Hit your browser's Reload button to play again.<P>\r
503"""\r
504\r
505DELETE = """\r
506At the moment, there's no direct way to delete entries.\r
507This is because the entry numbers are also their\r
508unique identifiers -- it's a bad idea to renumber entries.\r
509<P>\r
510If you really think an entry needs to be deleted,\r
511change the title to "(deleted)" and make the body\r
512empty (keep the entry number in the title though).\r
513"""\r
514\r
515# Help file for the FAQ Edit Wizard\r
516\r
517HELP = """\r
518Using the %(FAQNAME)s Edit Wizard speaks mostly for itself. Here are\r
519some answers to questions you are likely to ask:\r
520\r
521<P><HR>\r
522\r
523<H2>I can review an entry but I can't commit it.</H2>\r
524\r
525The commit button only appears if the following conditions are met:\r
526\r
527<UL>\r
528\r
529<LI>The Name field is not empty.\r
530\r
531<LI>The Email field contains at least an @ character.\r
532\r
533<LI>The Log message box is not empty.\r
534\r
535<LI>The Password field contains the proper password.\r
536\r
537</UL>\r
538\r
539<P><HR>\r
540\r
541<H2>What is the password?</H2>\r
542\r
543At the moment, only PSA members will be told the password. This is a\r
544good time to join the PSA! See <A\r
545HREF="http://www.python.org/psa/">the PSA home page</A>.\r
546\r
547<P><HR>\r
548\r
549<H2>Can I use HTML in the FAQ entry?</H2>\r
550\r
551Yes, if you include it in &lt;HTML&rt; and &lt;/HTML&gt; tags.\r
552<P>\r
553Also, if you include a URL or an email address in the text it will\r
554automatigally become an anchor of the right type. Also, *word*\r
555is made italic (but only for single alphabetic words).\r
556\r
557<P><HR>\r
558\r
559<H2>How do I delineate paragraphs?</H2>\r
560\r
561Use blank lines to separate paragraphs.\r
562\r
563<P><HR>\r
564\r
565<H2>How do I enter example text?</H2>\r
566\r
567Any line that begins with a space or tab is assumed to be part of\r
568literal text. Blocks of literal text delineated by blank lines are\r
569placed inside &lt;PRE&gt;...&lt;/PRE&gt;.\r
570"""\r
571\r
572# Load local customizations again, in case they set some other variables\r
573\r
574try:\r
575 from faqcust import *\r
576except ImportError:\r
577 pass\r