[PEAK] bulletins example OF DOOM
Stephen Waterbury
golux at comcast.net
Fri Apr 9 13:15:08 EDT 2004
Phillip J. Eby wrote:
> At 03:29 AM 4/9/04 -0400, Stephen Waterbury wrote:
> You used this syntax:
>
> ('//',), (user, (':', passwd), '@'), (server,), ('/', db,)
>
> Which means, "optional // followed by optional user:pw@ clause, followed
> by optional server, optionally followed by a '/',db pair. I think you
> might actually want something closer to this:
>
> ('//',), ((user, (':', passwd), '@'), server), '/', db,
>
> which means, "optional // followed by an optional [user[:pw]@]server
> clause, followed by a required / and DB.
>
> (Tuples in the syntax are translated to "optional" parts. Nested tuples
> indicate optional within the optional.)
Cool, I like the syntax for syntax! That was what I had guessed it
was doing. Your suggestion works for createdb (THANKS!),
but a variation I like slightly better, which also works, is:
('//',), ((user, (':', passwd), '@'), server, '/'), db,
which allows me to use:
databaseURL = 'pypgsql:bulletins'
... I like it better without a required '/' before the dbname.
So, onward:
I tried 'adduser' and got the attached traceback.
Thanks again!
Steve
-------------- next part --------------
#!/usr/local/bin/peak runIni
[Load Settings From]
# This loads the general program settings - don't change:
file = config.fileNearModule('bulletins', 'bulletins.ini')
# From this point on, you can modify as appropriate:
[peak.naming.schemes]
pypgsql = 'peak.storage.SQL.GenericSQL_URL'
[bulletins]
databaseURL = 'pypgsql:bulletins'
databaseDDL = config.fileNearModule('bulletins', 'sqlite-ddl.sql')
[peak.logs]
# Set default logging to stderr, DEBUG level
* = logs.LogStream(stream=importString('sys.stderr'), levelName='DEBUG')
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SQL.py
Type: application/python
Size: 19172 bytes
Desc: not available
Url : http://www.eby-sarna.com/pipermail/peak/attachments/20040409/ee10d82b/SQL.bin
-------------- next part --------------
[waterbug at bigboote bulletins]$ peak runIni bulletins adduser zaphod 42 Zaphod Beeblebrox
Traceback (most recent call last):
File "/usr/local/bin/peak", line 4, in ?
commands.runMain( commands.Bootstrap )
File "/usr/local/lib/python2.3/site-packages/peak/running/commands.py", line 70, in runMain
result = factory().run()
File "/usr/local/lib/python2.3/site-packages/peak/running/commands.py", line 211, in run
return self._run() or 0
File "/home/waterbug/sandbox/PEAKsb/bulletins/src/bulletins/commands.py", line 62, in _run
user = self.Users.newItem()
File "C:\cygwin\home\pje\PEAK\src/peak/binding/_once.pyx", line 112, in _once.BaseDescriptor.__get__
File "C:\cygwin\home\pje\PEAK\src/peak/binding/_once.pyx", line 100, in _once.__get__
File "/usr/local/lib/python2.3/site-packages/peak/binding/once.py", line 518, in __call__
return adapt(importString(self.subject), IRecipe)(
File "/usr/local/lib/python2.3/site-packages/peak/util/imports.py", line 79, in importString
item = __import__('.'.join(path), globalDict, globalDict, ['__name__'])
File "/home/waterbug/sandbox/PEAKsb/bulletins/src/bulletins/storage.py", line 124, in ?
class CategoryDM(storage.EntityDM):
File "/home/waterbug/sandbox/PEAKsb/bulletins/src/bulletins/storage.py", line 126, in CategoryDM
db = binding.bindTo(DATABASE)
AttributeError: 'LazyModule' object has no attribute 'bindTo'
More information about the PEAK
mailing list