From ken at miriamtech.com Fri Jun 1 19:48:49 2007 From: ken at miriamtech.com (Ken Treis) Date: Fri, 1 Jun 2007 10:48:49 -0700 Subject: Magritte pre-validation hooks? Message-ID: <4730BD26-D364-4D89-B632-D24D249F156F@miriamtech.com> Is there an easy way in Magritte to clean up user-supplied data before validation? I'm doing something like this: > Address>>state: aString > state := aString ifNotNil: [:s | s trimBlanks] > > Address class>>descriptionState > ^(MAStringDescription auto: 'state' label: 'State') > addCondition: [:value | value trimBlanks size = 2] labelled: > 'Please enter a two-character abbreviation'; > yourself In Rails, ActiveRecord offers a before_validation hook for this kind of cleanup. I have mostly used it to coerce empty strings to nil, but it looks like Magritte's default string reader at least does that part for me. Should I implement my own StringReader to accomplish this in one place? -- Ken Treis Miriam Technologies, Inc. From Martial.Boniou at ifrance.com Fri Jun 1 22:50:55 2007 From: Martial.Boniou at ifrance.com (Martial Boniou) Date: Fri, 1 Jun 2007 22:50:55 +0200 Subject: PRComponentSettings disappeared and... PRStriketroughFormat is obsolete In-Reply-To: <20070531195416.GB1097@cendre> References: <20070531141139.GA838@cendre> <20070531151420.GB838@cendre> <20070531160848.GA1097@cendre> <6EE0B70A-793A-4C60-8C77-746FDA72E072@iam.unibe.ch> <20070531195416.GB1097@cendre> Message-ID: <20070601205055.GA614@Cendre.local> In the yesterday fix in Pier, Lukas corrected the syntax error PRStriketroughFormat to PRStrikethroughFormat. Like the PUSecurity filtering proposed by Lukas in this thread, the following short script could help anyone who's got a kernel with the old format: | a f index | #(#PRStriketroughFormat #PRStrikethroughFormat ) pairsDo: [:badGroup :newGroup | PRDocumentGroup allSubInstancesDo: [:e | f := e children. index := 0. [(index := index + 1) <= f size] whileTrue: [a := f at: index. a class isOsbolete ifTrue: [('*' , badGroup asString match: a class asString) ifTrue: [f at: index put; ((Smalltalk at: newGroup ifAbsent: [PRParagraph]) new setChildren: a children copy)]]]]] "end of script" I hope Lukas will add those kind of messages to permutate the obsolete PRFormat (even if it's happened one time). Cheers, -- Martial Martial Boniou a ?crit : | Lukas Renggli a ?crit : | | > | > I found that the PUSecurity instances maintain the Settings in the | | > | > arrays | | > | > #ownerPermissions and #groupPermissions. How can I remove them | | > in each | | > | > decorations ? | | > | | | > | Did you try something like? | | > | | | > | PUSecurity allInstancesDo: [ :e | e remove ] | | > | | > That's what I just was doing. Unfortunately it's the only way for | | > instance. | | | | That would be preserve all the security settings ... | | | | PUSecurity allInstancesDo: [ :e | | | e ownerPermissions: (e ownerPermissions | | reject: [ :f | f command isObsolete ]). | | e groupPermissions: (e groupPermissions | | reject: [ :f | f command isObsolete ]). | | e otherPermissions: (e otherPermissions | | reject: [ :f | f command isObsolete ]). | | | | That works. | I was searching a thing like that. One must add a "f command isNil" to | filter all bad built PUPermission. Maybe it would be cool to add such a | test for each Pier upgrade. I did this: | | (PUSecurity instVarNames | select: [:p | '*Permissions' match: p]) | do: [:me | PUSecurity allInstancesDo: [:ea | | ea perform: (me , ':') asSymbol | with: ((ea perform: me asSymbol) reject: | [:c | c command isNil or: | [c command isObsolete]])]]. | | Thanks, | | -- | Martial | | | Lukas | | | | -- | | Lukas Renggli | | http://www.lukas-renggli.ch | | | | | | | | _______________________________________________ | | SmallWiki, Magritte, Pier and Related Tools ... | | https://www.iam.unibe.ch/mailman/listinfo/smallwiki | | | _______________________________________________ | SmallWiki, Magritte, Pier and Related Tools ... | https://www.iam.unibe.ch/mailman/listinfo/smallwiki | From kamikaze.is.waiting.you at gmail.com Sat Jun 2 05:08:28 2007 From: kamikaze.is.waiting.you at gmail.com (Oleg Korsak) Date: Sat, 2 Jun 2007 06:08:28 +0300 Subject: Pier Login and menu Message-ID: <3191c1c60706012008q2ae3bbfen41d2a254540fb1fd@mail.gmail.com> Hello again :) How can I create my own link in the wiki page to the Login form (I want to hide Commands box)? Also I have my own menu at http://kamikaze.seasidehosting.st/ but my links are constant and doesn't have any session data. So if somebody is logged in and presses any of top menu items - he is going to be logged off :| Any advices how to organize links in this menu? It is