[web2py] Re: How to achieve more info from AD/LDAP auth and add those info into DB?

2011-12-21 Thread Dan
Yes, I can help to test with AD environment.

I did changes in auth_ldap.py on the retrieveAttributes

retrieveAttributes =['displayName','mail','sAMAccountName']

and I can get the "result" with my correct AD info

result = {'mail': ['dan.x...@mycompany.com'], 'displayName':
['.Dan'], 'sAMAccountName': ['MyADName']}

But still can not pass those above info into DB.py or default.py.

On Dec 22, 12:15 pm, Massimo Di Pierro 
wrote:
> Not yet. If you are available to help testing we can it done soon.
>
> On Dec 21, 4:13 am, Dan  wrote:
>
> > Hi all,
>
> > I'm a newbie on web2py. I'm using web2py 1.99.4 and successfully used
> > auth_ldap to pass the authentication, and after that I want to create
> > AD user's info (DisplayName, Email, etc)into the database in db.py.
>
> > But It seems that I only got the db.auth_user.name, others like
> > "db.auth_user.email" are empty.
>
> > In the post-login page auth_user are
> >  > 'last_name': '', 'registration_id': '', 'id': 5, 'reset_password_key':
> > '', 'password': None, 'registration_key': '', 'email': ''}>
>
> > I know in the auth_ldap.py we only query/search "sAMAccountName" from
> > AD system. It that possible we query more"DisplayName or Email" and
> > using it in the db.py?  Many thanks.
>
>


[web2py] Re: Is there any "mainstream" wysiwyg html editor in web2py world?

2011-12-21 Thread Ray (a.k.a. Iceberg)
Just want to give some correction about my previous comment.

In WYMeditor, by default the heading 1/2/3/.../6 looks in normal black-
on-white color. They look in red, only when pasting formatted text
from MS WORD into any empty container in the editor panel. Pasting
into nonempty container won't trigger the "red problem". And all those
only happen in my Chrome 15.

If I use IE8 to test again, pasting formatted text from WORD into
editor panel results in losing all structures and formatting. That is
a show stopper for me.

In short, WYMeditor is somewhat intangible, inconsistent. What a pity,
I did love its WYSIWYM philosophy and really wanted to give it a shot.
Perhaps I can save it for being my personal blog posting tool.

Regards,
Ray

On Dec 22, 2:53 am, "Ray (a.k.a. Iceberg)"  wrote:
> Hi LightDot,
>
> Thanks for the remind. Actually WYMeditor was on my radar. I love its
> clean output code philosophy. However its default look-and-feel could
> surprise my end users, I am afraid. For example, those heading
> 1/2/3/.../6 containers look scary red when editing, although they look
> "normal" again when previewing. 
> Seehttp://files.wymeditor.org/wymeditor/trunk/src/examples/01-basic.html
>
> Maybe WYMeditor does this on purpose, but I expect an editing
> experience would be less surprising to end users. (The least-
> surprising rule when designing a UI.)
>
> That said, I think that is "just" a css issue. So if someday I found a
> handy css for it, then I would fall in love with WYMeditor.
>
> Regards,
> Ray
>
> On Dec 22, 1:45 am, LightDot  wrote:
>
>
>
>
>
>
>
> > I agree, most of the better known editors are bloated. I try to keep away
> > if I can, especially from tiny and ckeditor. I haven't used elrte before,
> > it seems a bit better. I have used jHtmlArea on a couple of projects with
> > success, but lately I prefer WYMeditor. The .js is about 120kb minified,
> > though, so still way bigger that jHtmlArea.
>
> > It's a strict XHTML WYSIWYM editor (not WYSIWYG, looks even better as far
> > as I'm concerned). It needs a bit of UI polishing, but it produces great
> > code. If anyone tries it out, I strongly suggest using the latest beta
> > releases or the code from the repo. Old stable releases are pretty stale.
>
> >https://github.com/wymeditor/wymeditor


Re: [web2py] Re: What is the best way to migrate a production server to 1.99.4?

2011-12-21 Thread Johann Spies
On 22 December 2011 06:16, Massimo Di Pierro wrote:

> Just unzip new web2py over old one and restart the web server. Make
> sure you backup. ;


If the apps in production were developed with a version of Web2py before
the existence of smartgrid you might have to update your static/js  and
static/css filed in those apps.  I would test it first on a copy of the
apps to make sure that you don't break something.


Regards
Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)


Re: [web2py] Re: web2py on github

2011-12-21 Thread Daniel Aguayo Catalán

Massimo Di Pierro wrote:

I hate all changes related to this topic. This is because I have to
learn a new system and do extra work to move stuff around. There was a
lot of push for git and github so we did it.

Please, let's not open this can of worms again. The costs of changing
outweighs the benefits.

Massimo

He he, don't worry :). My apologies if this topic is still kind of 
sensible. I thought that bitbucket was more restrictive and the free 
private project hosting was a plus and killer feature over other 
services, at least for me (that sadly have not gitourious nor github). 
So I just wanna to know a comparison of bitbucket and github from your 
perspective to choose my personal repo, but now I can see that was 
nothing in particular.


I know that github is the 'pop-choice' for project hosting these days 
and I have no problem with that (gitorious.org and bitbucket has fairly 
same workflow as github), so please don't considerate this as a kind of 
flame of DVCS hosting.


Thanks to all for your answer.
Best regards
--
Daniel


Re: [web2py] Re: Development of the Framework

2011-12-21 Thread Rhys Tague
Hey Anthony,

This is exactly what I was looking for. It clears a lot up.

Cheers,

Rhys (no one seems to be using nick names so I've dropped my Sententia nick)

On 22 December 2011 15:20, Anthony  wrote:

> Hi Sententia,
>
> Welcome. A few thoughts below...
>
>
> I was wondering if someone from this user group could give a practical
>> and straight response about the future development of this framework
>> and it's ability to be flexible?
>>
>
> Could you be a little more specific? What do you want to know about future
> development, and what do you mean by being "flexible"? Development of
> web2py is very active (typically multiple commits per day, and a new
> release about once a month). It has been developed for over four years, has
> an active and passionate user community, and a large number of
> contributors, so I'm sure it will be under active development for a long
> time to come. It's also very open and fairly informal, so if you have ideas
> and want to get involved, it's very easy to make contributions yourself.
>
>
>> I've spoken on the IRCs
>> and asked a few people and they have shot web2py down quite heavily.
>>
>
> I don't know what was said in those particular chats or who was involved,
> but I have seen that kind of talk in other places. In my experience, most
> of it is FUD, and those spreading it typically have never actually used
> web2py. In many cases, they themselves have some kind of stake in
> alternative frameworks. When challenged to provide evidence or details,
> they often disappear from the conversation.
>
> To be sure, web2py does do some things differently from other Python
> frameworks. In particular, it is willing to forego some (mostly unhelpful)
> "explicitness" in favor of making development quicker and easier. Without
> ever trying web2py, some "Pythonistas" imagine that this causes all kinds
> of trouble, but they ignore the evidence of thousands of happy users who
> are not in fact experiencing these hypothetical problems in actual real
> world usage.
>
> Anyway, if you want to discuss any particular criticisms you have heard,
> we'd be happy to weigh in.
>
>
>> If I know the framework which I'm going to use is flexible with a
>> bright future, I can add my extensions to work with it and know that
>> it wont be a dead end.
>>
>
> I don't think you'll have to worry about that with web2py. I think you'll
> also find the web2py community to be a particularly welcoming and helpful
> one.
>
>
>> Also, why is there 14 people in #web2py but 149 people #pyramid? Why
>> is a framework which is so known, so unfollowed?
>>
>
> For whatever reason, web2py folks tend not to be big on IRC and instead
> primarily come to this forum for discussion and support. Note, the web2py
> Google group (which is growing steadily) has 30% more members than the
> Pyramid group and posts nearly 10 times as many messages -- so I think
> overall our community is probably even more active. Also, web2py was
> recently rated best among six Python web 
> frameworksby
>  InfoWorld, and received an InfoWorld Bossie
> Awardfor
>  best open source development software.
>
> Hope that helps.
>
> Best Regards,
> Anthony
>


[web2py] Help with OAuth20 facebook infinite redirect

2011-12-21 Thread Michael Toomim
I just upgraded from a modified 1.98.2 to 1.99.4 and now I'm getting
an infinite redirect when logging in with OAuth20 and facebook.

I'm having trouble debugging. Can someone help?

What happens:
User goes to /user/login
This calls this code in tools.py:

# we need to pass through login again before going on
next = self.url('user',args='login')
redirect(cas.login_url(next))

which calls this in contrib/login_methods/oauth20_account.py:

def login_url(self, next="/"):
self.__oauth_login(next)
return next

and __oauth_login(next) will eventually redirect the user to this
Facebook url to authenticate:

 
https://graph.facebook.com/oauth/authorize?scope=email&redirect_uri=myapp.com%2Fuser%2Flogin&response_type=code&client_id=181047918589726

...the user then logs in at facebook, and facebook returns back a code
to us at /user/login?code=

Ok! Now we're at /user/login again. This calls the same functions as
above (cas.login_url(next), which again calls __oath_login(next)), but
this time the "code" variable is set, so we get an access token
created. Great!

BUT then __oath_login() returns to login_url() which returns "/user/
login" to the redirect function I pasted earlier:

# we need to pass through login again before going on
next = self.url('user',args='login')
redirect(cas.login_url(next))

...And the whole thing redirects BACK to /user/login. And then the
whole cycle repeats itself from scratch! The login function redirects
us to facebook, facebook gives us a code, sends us back to login,
login creates an access_token, and then this all returns to tools.py
which redirects us back to /user/login.

Where is this supposed to stop cycling and go to a normal url instead
of /user/login?


Re: [web2py] Re: Combine SQLFORM and SQLFORM.grid?

2011-12-21 Thread Martin Weissenboeck
a lot of ideas - many thanks to all.
i will try it during the next days!

2011/12/21 apple 

> I missed a bit..[I did say it was a bit fiddly!]
>
> You still need to refresh the grid when the dialog box closes. To do
> this I replaced the LOAD calls with load2 which adds a url to the
> component:
>
> def load2(**args):
>""" calls LOAD and sets url attribute to enable easy refresh of
> the component """
>s=Storage(**args)
>if s.url: url=s.url
>else: url=URL(c=s.c, f=s.f, args=s.args, vars=s.vars,
> extension=s.extension)
>return LOAD(_url=url, **args)
>
> ###
> Then in the view:
>
> // refresh a web2py component using url attribute
> function refresh(component) {
>web2py_ajax_page("get", $('#'+component).attr("url"), null ,
> component)
> }
> #
> and in the controller you add "refresh('gridid')" to v._onacceptjs.
>
> If you need to you can refresh other components in the same way e.g.
> if your edit form has a count of the rows on the grid then you might
> want to refresh it.
>
> Thats it!!!
>
> On Dec 21, 8:03 pm, apple  wrote:
> > I have done something similar to what you are looking for but it was a
> > little fiddly in places (if someone can suggest a better way I would
> > be delighted!). My application had some extra functionality but the
> > gist of it is:
> >
> > You have a form and a grid. You can put these on the same page easily
> > using LOAD component.
> >
> > {{=LOAD(f='edit.load', ajax=True, args=.}}
> > {{=LOAD(f='grid.load', ajax=True, args=.}}
> >
> > Now you have them on the same page.
> >
> > ###
> > But when you add/edit a grid row then you have 2 forms and 2 submit
> > buttons on the page which is odd. So I used a dialog box for the add/
> > edit functions. This is actually quite easy as the majority of the
> > code is already included in web2py.
> >
> > In the view you do this:
> >
> > // create dialogbox
> > document.write("")
> > $(document).ready(function(){
> > $('#dialogdiv').dialog({autoOpen : false, modal : false, width :
> > 'auto'});})
> >
> > // open url in dialog box
> > function dialog(url) {
> > web2py_ajax_page("get", url, {_newformjs:"$
> > ('#dialogdiv').dialog('open')"} , 'dialogdiv')
> >
> > }
> >
> > Now if you pass any url to the javascript dialog function it will call
> > the controller and open the form in a dialog box; and return any form
> > errors inside the dialog box. And only half a dozen lines of code!!
> >
> > ###
> > Now you need to make the form open and close.
> >
> > In the edit controller (for person) you do this:
> >
> > if form.process(.).accepted:
> > response.js=v._onacceptjs
> > return
> > elif form.errors:
> > pass
> > else:
> > response.js=v._newformjs
> > 
> > and in the grid controller you setup the dialog close and rewire the
> > buttons
> >
> > def dialog(url):
> > """ returns javascript to show the view as a dialog box """
> > return "dialog("+quote(url)+"); return false;"
> >
> > def grid():
> > editvars['_onacceptjs']="$('#dialogdiv').dialog('close');"
> >
> > links.append(lambda row: A(SPAN(_class='ui-icon ui-icon-pencil'),
> >SPAN('Edit',_class='ui-button-
> > text',_title='Edit'),
> >_onclick=dialog(URL(editcontroller,
> > vars=editvars, args=[a.tablename, row.id])),
> >_class='ui-button-text-icon-primary',
> > _id='edit'))
> >
> > On Dec 21, 1:54 pm, Cliff  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Remember web2py uses the term 'form' in a very specific way.
> >
> > > So don't think about a web2py form for CRUD operations on child
> > > records.  You need a way to dynamically update the web page so it can
> > > manage the child records.  Web2py provides several approaches to this
> > > problem.
> >
> > > The image blog example in the book outlines a design approach that
> > > will solve your problem.
> http://web2py.com/books/default/chapter/29/3#An-image-blog
> >
> > > Also look here for other solutions:
> http://web2py.com/books/default/chapter/29/11#The-ajax-functionhttp:/...
> >
> > > On Dec 21, 1:22 am, Martin Weissenboeck  wrote:
> >
> > > > Ok, thank you - I will try it.
> >
> > > > 2011/12/21 Nik Go 
> >
> > > > > Martin,
> >
> > > > > I have a feeling that what you're looking is "multi-form updates"
> (try to
> > > > > search for that term) where a parent record (your "person") and
> child
> > > > > record (your "cvrows") are updated simultaneously.
> >
> > > > > On Wednesday, December 21, 2011, Jim Steil wrote:
> >
> > > > >>  have you looked at SQLFORM.smartgrid?
> >
> > > > >> -Jim
> >
> > > > >> On 12/20/2011 1:39 PM, Martin Weissenboeck wrote:
> >
> > > > >> Thanks for all hints, I have f

[web2py] How to make smartgrid redirect to edit after creating new record?

2011-12-21 Thread Cliff
Smartgrid is great when you have linked tables.

But I know I'm going to get some user push back on adding records with
linked tables.

After adding a record, they like to go right back and edit the record
to add child records. For example, if a user creates a purchase order
header, he wants to go right back to edit the P.O. and add products.
He does not want to go back to the list of P.O.s, search for the one
he just created and then click edit.

Unfortunately, smartgrid forces the user to do exactly what he does
not want to do because it shows the index list of records after a
successful create.

How can I make my users happy by directing them to edit the record
they just created in smartgrid.

It used to be simple, like this:
if form.process().accepted:
  redirect(URL('edit'))

Even in grid I can do this:
if form[1].process().accepted:
  redirect...

How do I emulate this behavior in smartgrid?

Thanks,
Cliff Kachinske


[web2py] Re: Sort order for related table grids in SQLFORM.smartgrid

2011-12-21 Thread Adi
Massimo,
Is it possible to limit the scope of orderby only to a parent table, and 
not children? Once I click to see "children" records I get an error that 
the column is unknown in "order clause" 1054



[web2py] Re: Linking to uploaded files (when using separate folders)

2011-12-21 Thread Yarin
Thanks Anthony-

On Dec 21, 3:00 pm, Anthony  wrote:
> It's tricky, but everything you need is in the encoded filename. With
> uploadseparate=True, the file is stored in a subfolder named
> /table.field/[first 2 characters of filename uuid]. Try something like this:
>
> sub = file.split('.')
> url = URL('static', 'userpics/%s.%s/%s/%s' % (sub[0], sub[1], sub[2][:2],
> file) )
>
> Anthony
>
>
>
>
>
>
>
> On Wednesday, December 21, 2011 2:29:15 PM UTC-5, Yarin wrote:
>
> > I was trying trying to bypass the download function and use a static
> > link
>
> > According to Massimo:
> > "In 'uploads' if you need authorization. In 'static' if you do not. In
> > the latter you do not need to worry about
> > authorization and you can let the web server by-pass web2py"
>
> > I actually think the download link will work for me in this case, but
> > was wondering how it could be done for static links.
>
> > On Dec 21, 1:18 pm, Adi  wrote:
> > > wouldn't this bring exactly the path where you store it:
> > >  > > width="100px"  alt="some text" />
>
> > > maybe i'm missing the mark?


[web2py] Re: URL fragment identifiers persist after redirect

2011-12-21 Thread Yarin
Yes, that makes sense- thanks

On Dec 21, 10:13 pm, Anthony  wrote:
> Note, browsers don't send fragment identifiers to the server, so web2py has
> no control over this. As far as I know, this is standard behavior for most
> browsers. It actually makes sense when you think about the meaning of a 30x
> redirect -- the server is saying that the resource requested can be found
> at a different URL, so the browser assumes the original fragment identifier
> can simply be applied to the new URL to find the fragment within the
> resource. Of course, in many cases, we're redirecting to a different
> page/resource, so it seems odd in those cases.
>
> Anthony
>
>
>
>
>
>
>
> On Wednesday, December 21, 2011 9:45:21 PM UTC-5, Yarin wrote:
>
> > I've noticed that when redirecting from a url with hash fragment ids
> > in the url, the fragment ids persist to the new url. This does not
> > seem right- for instance, when submitting a form on a screen with a
> > fragment id, the thank-you page gets the same url fragment.
>
> > Consider two simple pages:
>
> > def hello():
> >     redirect(URL('goodbye'))
> >     return dict(message='hello')
>
> > def goodbye():
> >     return dict(message='goodbye')
>
> > /default/hello#there -> redirects to
> > /default/goodbye#there


[web2py] Re: new appliances - Happy Holidays

2011-12-21 Thread Massimo Di Pierro
two more comments:

- I ported KPAX to Auth but only partially. I am sure I have
introduced some bugs. Please report them.

- It is a bit of a nightmare to checkout the repo into applications
because it may conflict with the parent web2py repo. Thinking about a
solution... open to suggestions.

On Dec 21, 10:12 pm, Massimo Di Pierro 
wrote:
> I finally did it. I cleaned up appliances; deleted the very old ones;
> upgraded some old ones; fixed some; added some good ones. They all
> work now with the latest web2py. I moved them all on githup.
>
> http://web2py.com/applianceshttps://github.com/mdipierro/web2py-appliances
>
> Each appliances comes prepackaged (w2p) with screenshots. Each app as
> an ABOUT file that needs to be edited. This is on my TODO list but I
> could use your help.
>
> I will take patches. ;-)
>
> I am planning a better interface to this github repo that will list
> screenshots. Perhaps tomorrow
>
> Happy Holidays everybody.
>
> Massimo


[web2py] Re: new appliances - Happy Holidays

2011-12-21 Thread Anthony
Awesome! Great work. :-)

[web2py] Re: Web Development Introduction Based On Web2py

2011-12-21 Thread Massimo Di Pierro
It is really great. I am planning to link it from the main web site
***

Massimo

PS. *** will SOPA allow it? Or can I get in trouble?

On Dec 20, 12:33 pm, "ma...@rockiger.com" 
wrote:
> I published the first 3 chapters of my web development tutorial 
> athttp://killer-web-development.com
>
> It's aimed at total web development beginners and uses web2py as framework.
>
> The idea was to write a web development tutorial based on web2py, because
> web2py is the easiest
> to use web development solution - maybe I can rescue a few people from
> starting with PHP.
>
> The book aims to be an mixture of railstutorial.org and the Head First
> series. Lots of images and
> very low level subject matter. A the end readers will develop a full
> microblogging service.
>
> I would appreciate any feedback.
>
> Best
> marco


[web2py] Re: compute=lambda r: don't return all the fields

2011-12-21 Thread Massimo Di Pierro
It work at level of inserting data in the database. It works if the
input contains the data needed for the computation.

On Dec 21, 5:42 pm, Vinicius Assef  wrote:
> As book says...
> "DAL fields may have a compute attribute. This must be a function (or
> lambda) that takes a Row object and returns a value for the field."
>
> So, lambda for computed fields gets all fields and returns just one field.
>
> I think it work on DAL level, not on FORM level.
>
> On 12/19/11, Richard Vézina  wrote:
>
>
>
>
>
>
>
> > I don't get all my db.table fields form define_table fields defined...
>
> > A other guy report that... But didn't find exactly why his compute
> > functions as stop working properly...
>
> > To me it's related to the fact tha if I do :
>
> > Field('mycomputefield', compute=lambda r: r)
>
> > I am not getting all the fields.
>
> > For example:
>
> > db.define_table('test1',
> >     Field('f1','string'),
> >     Field('f2','integer'),
> >     Field('computefield',compute=lambda r: r))
>
> > Will return only field that appear in form, so if I set f1 to
> > writable=False, it will not be in form so it will not be available to
> > compute function...
>
> > I think it for make compute failed silently if some fields are set to
> > writable or readable = False... But I would return all the field to compute
> > with a "None" for empty field instead of not returning any key... I really
> > don't know if it even possible, if it is a bug or something else...
>
> > I work around issue I were having with compute (I would compute a md5 hash
> > for row so I would have all key/value pairs even if one of those were
> > empty, but I can't with compute), so I use the new virtual field style
> > (hope it will stay).
>
> > Here the thread I am refering to :
> >http://groups.google.com/group/web2py/browse_thread/thread/cd6191f982...
>
> > Richard
>
> > On Mon, Dec 19, 2011 at 2:22 PM, Anthony  wrote:
>
> >> What do you mean it doesn't return all the fields?
>
> >> On Monday, December 19, 2011 10:47:42 AM UTC-5, Richard wrote:
>
> >>> Hello,
>
> >>> I try to use compute to generate a record md5_hash on insert and
> >>> update, but I discover that compute=lambda r: don't return all the
> >>> db.table fields why?
>
> >>> Thanks
>
> >>> Richard


[web2py] Re: Problem with Web2py sql that includes % on Postgres; breaking New Relic

2011-12-21 Thread Massimo Di Pierro
Thank you Patrick and Graham.

On Dec 21, 3:05 pm, pbreit  wrote:
> Graham sent me a patched NewRelic agent (version 1.0.6.176) which appears
> to be working fine.


[web2py] Re: GAE SQLFORM not inserting into datastore

2011-12-21 Thread Massimo Di Pierro
form = SQLFORM(db.test)

must be followed by

form.process()

or

form.accepts(request,session) # equivalent

else the form is not processed

On Dec 21, 2:36 pm, Murray3  wrote:
> As per latest 
> documentation:http://web2py.com/books/default/chapter/29/13#Deployment-recipes
> In model i have:
> db.define_table('test',
>     Field('test', 'string'),
>     Field('image', 'upload'))
> In controller I have:
> def test():
>     form = SQLFORM(db.test)
>     return dict(form=form)
> In view I have:
> {{extend 'layout.html'}}
> {{=form}}
> does not insert record in to local GAE datastore, is this missing
> someething? or what is missing from docs?
> any feedback appreciated.
>
> ps this is a new post as the previous thread seems to have gone awol!


[web2py] Re: web2py on github

2011-12-21 Thread Massimo Di Pierro
I hate all changes related to this topic. This is because I have to
learn a new system and do extra work to move stuff around. There was a
lot of push for git and github so we did it.

Please, let's not open this can of worms again. The costs of changing
outweighs the benefits.

Massimo

On Dec 21, 1:45 pm, Willoughby  wrote:
> Short Answer: Because that's what the developers wanted and agreed to.
>
> Search the web2py-developer group for the months long discussion on
> changing it if you "really want to know"
>
>
>
>
>
>
>
> On Wednesday, December 21, 2011 10:20:38 AM UTC-5, Daniel Aguayo wrote:
>
> > I know that web2py doesn't need a private project option, but since
> > bitbucket is also free and support git, has issue tracker, wiki, etc,
> > why use github? I really want to know...


[web2py] Re: SQLFORM doesn't render attributes adjusted after form creation

2011-12-21 Thread Massimo Di Pierro
yes. that is a logic issue

form = SQLFORM(...)
form['_class']= '...'

{{=form}} renders for with new attributes

{{=form.custom.begin}} is a variable defined before the _class was
changed.

On Dec 21, 1:34 pm, Anthony  wrote:
> That method will work in general, but not with form.custom.begin and
> form.custom.end specifically. I guess we should make that clear in the book.
>
> Anthony
>
>
>
>
>
>
>
> On Wednesday, December 21, 2011 1:44:03 PM UTC-5, viniciusban wrote:
>
> > In web2py book, on chapter FORMS and VALIDATORS, section Forms and
> > Validators, it's written:
>
> > ---
> > FORM and SQLFORM are helpers and they can be manipulated in as similar
> > way as the DIV. For example you can set a form style:
>
> > 1. form = SQLFORM(..)
> > 2. form['_style']='border:1px solid black'
> > ---
>
> > I'm using this very way to set "_class" attribute and custom form to
> > show my form.
>
> > So, in my view I have:
> > {{=form.custom.begin}}
> >     {{=form.custom.label.nome}} {{=form.custom.widget.nome}} 
> > {{=form.custom.end}}
>
> > But the "_class" attribute isn't rendered.
> > I did a code trace and discovered the _xml() method is called at form
> > creation time. This way, the "_class" attribute is there, inside my
> > form instance, but it isn't showed in my view.
>
> > Is it a bug or a book mistake?
> > How can I use it?
>
> > --
> > Vinicius Assef.


[web2py] Re: Development of the Framework

2011-12-21 Thread Anthony
Hi Sententia,

Welcome. A few thoughts below...

I was wondering if someone from this user group could give a practical 
> and straight response about the future development of this framework 
> and it's ability to be flexible?
>

Could you be a little more specific? What do you want to know about future 
development, and what do you mean by being "flexible"? Development of 
web2py is very active (typically multiple commits per day, and a new 
release about once a month). It has been developed for over four years, has 
an active and passionate user community, and a large number of 
contributors, so I'm sure it will be under active development for a long 
time to come. It's also very open and fairly informal, so if you have ideas 
and want to get involved, it's very easy to make contributions yourself.
 

> I've spoken on the IRCs 
> and asked a few people and they have shot web2py down quite heavily.
>

I don't know what was said in those particular chats or who was involved, 
but I have seen that kind of talk in other places. In my experience, most 
of it is FUD, and those spreading it typically have never actually used 
web2py. In many cases, they themselves have some kind of stake in 
alternative frameworks. When challenged to provide evidence or details, 
they often disappear from the conversation. 

To be sure, web2py does do some things differently from other Python 
frameworks. In particular, it is willing to forego some (mostly unhelpful) 
"explicitness" in favor of making development quicker and easier. Without 
ever trying web2py, some "Pythonistas" imagine that this causes all kinds 
of trouble, but they ignore the evidence of thousands of happy users who 
are not in fact experiencing these hypothetical problems in actual real 
world usage.

Anyway, if you want to discuss any particular criticisms you have heard, 
we'd be happy to weigh in.
 

> If I know the framework which I'm going to use is flexible with a 
> bright future, I can add my extensions to work with it and know that 
> it wont be a dead end.
>

I don't think you'll have to worry about that with web2py. I think you'll 
also find the web2py community to be a particularly welcoming and helpful 
one.
 

> Also, why is there 14 people in #web2py but 149 people #pyramid? Why 
> is a framework which is so known, so unfollowed?
>

For whatever reason, web2py folks tend not to be big on IRC and instead 
primarily come to this forum for discussion and support. Note, the web2py 
Google group (which is growing steadily) has 30% more members than the 
Pyramid group and posts nearly 10 times as many messages -- so I think 
overall our community is probably even more active. Also, web2py was 
recently rated best among six Python web 
frameworksby
 InfoWorld, and received an InfoWorld Bossie 
Awardfor
 best open source development software.

Hope that helps.

Best Regards,
Anthony


[web2py] Re: how to present rows in multiple pages

2011-12-21 Thread Massimo Di Pierro
It is included. SQLFORM.grid and smartgrid to it.

On Dec 21, 11:50 am, lyn2py  wrote:
> I was wondering... pagination is a very common task on webpages, is
> there a reason why it isn't included in web2py (and requires a plugin
> or hardcoding)?
>
> Thanks!
>
> On Dec 22, 12:00 am, Omi Chiba  wrote:
>
>
>
>
>
>
>
> > You can also use the plugin.http://dev.s-cubism.com/plugin_paginator
>
> > I use both SQLFORM.grid and this plugin depending on if the id filed
> > is available on the table.
>
> > On Dec 21, 9:39 am, thodoris  wrote:
>
> > > I have a query that returns many (45) results and i want to l present
> > > 10 rows per page and have links at the bottom with the page numbers
> > > (1,2,3,4,5 and maybe a button next or previews). How can i implement
> > > this in web2py?
>
> > > Thnx


[web2py] Re: new book now available in HTML (english, japanese, italian)

2011-12-21 Thread Massimo Di Pierro
If somebody sends me the 3rd edition in Spanish (in markmin) I will
post it and send the diff with 4th ed to the translators.

On Dec 21, 4:22 am, Alan Etkin  wrote:
> Is the spanish translation on the roadmap? Latinuxpress has made the
> 3d edition. I opened a thread in the spanish group asking the same.
> How is the translation work being managed?. Is it open to
> colaboration? I see that for example the italian has the 3d edition
> label and there seems to be just one translator.
>
> On 19 dic, 03:12, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > The latest book edition (4th) is now available for free here:
>
> >    http://web2py.com/book
>
> > This is not the final version of the new book application but it is a
> > major improvement over the old one.
> > It works on mobiles. Has true multi book, multi version and multi
> > language support.
>
> > I disabled some functions because they are not polished yet but I
> > should be done very soon.
> > When done I will open the book for editing so you can fix typos
> > yourself.
>
> > Should also be faster than the previous one.
>
> > Please give it a try and report any problems, including css issues.
> > Do not report typos quite yet. You will be able to fix them yourself.
>
> > Massimo


[web2py] Re: What is the best way to migrate a production server to 1.99.4?

2011-12-21 Thread Massimo Di Pierro
Just unzip new web2py over old one and restart the web server. Make
sure you backup. ;-)

On Dec 21, 6:59 am, Cliff  wrote:
> The subject says it all.
>
> I have apps in production on a customer's intranet.  The customer has
> asked for some enhancements.  I plan to use smartgrid, but I need the
> 1.99.4 version.
>
> What is the best way to upgrade in this situation?


[web2py] Re: How to achieve more info from AD/LDAP auth and add those info into DB?

2011-12-21 Thread Massimo Di Pierro
Not yet. If you are available to help testing we can it done soon.

On Dec 21, 4:13 am, Dan  wrote:
> Hi all,
>
> I'm a newbie on web2py. I'm using web2py 1.99.4 and successfully used
> auth_ldap to pass the authentication, and after that I want to create
> AD user's info (DisplayName, Email, etc)into the database in db.py.
>
> But It seems that I only got the db.auth_user.name, others like
> "db.auth_user.email" are empty.
>
> In the post-login page auth_user are
>  'last_name': '', 'registration_id': '', 'id': 5, 'reset_password_key':
> '', 'password': None, 'registration_key': '', 'email': ''}>
>
> I know in the auth_ldap.py we only query/search "sAMAccountName" from
> AD system. It that possible we query more"DisplayName or Email" and
> using it in the db.py?  Many thanks.


[web2py] new appliances - Happy Holidays

2011-12-21 Thread Massimo Di Pierro
I finally did it. I cleaned up appliances; deleted the very old ones;
upgraded some old ones; fixed some; added some good ones. They all
work now with the latest web2py. I moved them all on githup.

http://web2py.com/appliances
https://github.com/mdipierro/web2py-appliances

Each appliances comes prepackaged (w2p) with screenshots. Each app as
an ABOUT file that needs to be edited. This is on my TODO list but I
could use your help.

I will take patches. ;-)

I am planning a better interface to this github repo that will list
screenshots. Perhaps tomorrow

Happy Holidays everybody.

Massimo




[web2py] Re: smartgrid - modified_on field

2011-12-21 Thread Adi
resolved... "oncreate = callback_function_name" did the trick... love it. 

i had oncreate reserved for auth.archive... will figure out how to do both 
things.


[web2py] Re: smartgrid - modified_on field

2011-12-21 Thread Adi
apology, second question (uuid) resolved... it was misspelling. 




[web2py] Re: Web Development Introduction Based On Web2py

2011-12-21 Thread Andrew
Also consider the picture in the Introduction of the book, where the
request first goes to the Model before going to the Controller.  This
picture has helped me understand how the Model fits in and where the
request object comes from.

I think it would be confusing to change the order around, but it
depends if you're trying to show; how it works, or conceptually what
the user interaction is.

Having said that,  it looks great !I like the "Head First" style
of explanation, so I've bookmarked it too !


On Dec 22, 9:39 am, kasapo  wrote:
> Another way of looking at it is that the user is presented with views
> (or more accurately, HTML rendered from a view by a controller using
> the models) but interacts with controllers. Whenever a user clicks on
> an application link on a view, the browser sends a request and the
> controller handles it by dispatching data to a view and sending not
> the view, but rather the rendered HTML. If you have more interactive
> websites with javascript and ajax calls, then you are "interacting"
> with the rendered HTML or view, but even then AJAX calls to a web2py
> app talk to a controller that then sends a response.
>
> I guess it depends on what you mean by "interacts," but from the
> Marco's guide, he defines interaction as the HTTP request/response
> cycle (e.g. clicking on a link and asking for a resource):
>
> "When John's customers interact with a web2py-application via a
> browser, they send a request, which is received by the web server and
> passsed on to a controller."
>
> So I think the way he defines it is really best, but it's good to
> discuss these things I think.
>
> Anyway, that's just my $0.02.
>
> Good job Marco!
>
> I like the graphics with the "penciled in" arrows. Also I had no idea
> you could get a hosted app on fluxflex for free -- that's awesome.
>
> On Dec 21, 12:25 pm, Daniel Aguayo Catalán 
> wrote:
>
>
>
> > ma...@rockiger.com escribió:> Should go away, when all dns servers are 
> > updated.
>
> > Hi,
>
> > athttp://killer-web-development.com/section/1/3showsa diagram that
> > try to explain the MVC pattern that says:
>
> > [USER <-> CONTROLLER <-> VIEW,  USER <-> CONTROLLER <-> MODEL <- DATABASE]
>
> > ...but I think it should be as follows:
>
> > [USER <-> VIEW <-> CONTROLLER <-> MODEL <-> DATABASE]
>
> > ...because user just interact directly with Views and these make the
> > request to controllers and/or models. Or am I wrong?- Hide quoted text -
>
> - Show quoted text -


[web2py] Re: smartgrid - modified_on field

2011-12-21 Thread Adi
one more smartgrid question, if not a problem: is there a place to call a 
function once record is inserted through the form? I wanted to update a 
field, based on the value of newly inserted id. i understand that in a 
regular insert id = db.table.insert, but how to do it in smartgrid. 

thanks


[web2py] smartgrid - modified_on field

2011-12-21 Thread Adi
Two questions about smartgrid: 

* would there be any way/functionality to update a field like modified_on 
(Field('modified_on', 'datetime', default=request.now)) when we submit 
smartgrid form? 

* I have a field uuid (Field('uuid', length=64, 
default=lambda:str(uuid.uuid4())),), which shows in the edit and insert 
form, regardless that I set readable/writeable = False. Any way to make it 
hidden, or not show up? 

Thanks,
Adi


Re: [web2py] Re: Need to update the twitter book example?

2011-12-21 Thread Anthony
On Wednesday, December 21, 2011 6:55:29 PM UTC-5, viniciusban wrote:
>
> Anthony, when you say about needing update the book, could we
> understand someone is already doing that?


Massimo hasn't made the new online book editable yet -- when he does, these 
things will get fixed. 


[web2py] Re: URL fragment identifiers persist after redirect

2011-12-21 Thread Anthony
Note, browsers don't send fragment identifiers to the server, so web2py has 
no control over this. As far as I know, this is standard behavior for most 
browsers. It actually makes sense when you think about the meaning of a 30x 
redirect -- the server is saying that the resource requested can be found 
at a different URL, so the browser assumes the original fragment identifier 
can simply be applied to the new URL to find the fragment within the 
resource. Of course, in many cases, we're redirecting to a different 
page/resource, so it seems odd in those cases.

Anthony 

On Wednesday, December 21, 2011 9:45:21 PM UTC-5, Yarin wrote:
>
> I've noticed that when redirecting from a url with hash fragment ids 
> in the url, the fragment ids persist to the new url. This does not 
> seem right- for instance, when submitting a form on a screen with a 
> fragment id, the thank-you page gets the same url fragment. 
>
>
> Consider two simple pages: 
>
> def hello(): 
> redirect(URL('goodbye')) 
> return dict(message='hello') 
>
> def goodbye(): 
> return dict(message='goodbye') 
>
>
> /default/hello#there -> redirects to 
> /default/goodbye#there 
>
>

[web2py] Development of the Framework

2011-12-21 Thread Sententia
I was wondering if someone from this user group could give a practical
and straight response about the future development of this framework
and it's ability to be flexible?

The reason I ask is I'm moving into a section of my PhD where I'm
going to be building a social network so I can monitor user's online
collaborative behaviour and then adapt their environment based on
their classified behaviour through unsupervised machine learning. I've
chosen python as the language of choice, because I've only played
around with it a bit for general programming tasks and have fallen
heavily for it, as it is enjoyable to work in. I've spoken on the IRCs
and asked a few people and they have shot web2py down quite heavily.
If I know the framework which I'm going to use is flexible with a
bright future, I can add my extensions to work with it and know that
it wont be a dead end.

I know there are for and againsts for each framework, and web2py seems
pretty lean and clean, but the community (python that is) seem to lash
out at this framework when mentioning, which of course makes you spend
a lot of time trying to decipher the actual valuable content on why. I
know human beens are creatures of habit and hate change, but is that
really it?

Also, why is there 14 people in #web2py but 149 people #pyramid? Why
is a framework which is so known, so unfollowed?

...

Sententia


[web2py] URL fragment identifiers persist after redirect

2011-12-21 Thread Yarin
I've noticed that when redirecting from a url with hash fragment ids
in the url, the fragment ids persist to the new url. This does not
seem right- for instance, when submitting a form on a screen with a
fragment id, the thank-you page gets the same url fragment.


Consider two simple pages:

def hello():
redirect(URL('goodbye'))
return dict(message='hello')

def goodbye():
return dict(message='goodbye')


/default/hello#there -> redirects to
/default/goodbye#there



[web2py] Re: PyCon 2012: Talk acceptance - web2py: ideas we stole and ideas we had

2011-12-21 Thread Christopher Steel
Woot! Great title!



[web2py] Re: Need to update the twitter book example?

2011-12-21 Thread lyn2py
Not sure if you have noticed, but the web2py admin tweets are also not
showing up since 1.99.3

On Dec 21, 1:34 pm, Anthony  wrote:
> Yeah, I had an app using the old method -- looks like Twitter recently
> dropped support for that method. I guess we should update the book.
>
>
>
>
>
>
>
> On Tuesday, December 20, 2011 6:25:19 PM UTC-5, Alan Etkin wrote:
>
> > It seems that the get tweets example from the book (14.12) is not
> > working anymore:
>
> > When requesting from the browser's address field this location:
>
> >http://twitter.com/username?format=json
>
> > The output is an html page
>
> > I had to change the address to the twitter rest api search command:
>
> > Here is the related documentation
> >https://dev.twitter.com/docs/api/1/get/search
>
> > Does the current book example works for anybody?


[web2py] Re: Fwd: PyCon 2012: Talk acceptance - web2py: ideas we stole and ideas we had

2011-12-21 Thread lyn2py
Great News! :D

On Dec 22, 5:09 am, Massimo DiPierro  wrote:
> :-)
>
> Begin forwarded message:
>
>
>
>
>
>
>
> > From: 
> > Subject: PyCon 2012: Talk acceptance - web2py: ideas we stole and ideas we 
> > had
> > Date: December 21, 2011 2:25:39 PM CST
> > To: 
>
> > Dear Massimo Di Pierro,
>
> > I'm very pleased tell you that your talk has been accepted for PyCon
> > 2012 - congratulations! Please check that the details below are
> > correct, and read through this email for your next steps.
>
> >    Title: web2py: ideas we stole and ideas we had
> >    URL:https://us.pycon.org/2012/schedule/presentation/112/
>
> > We'll be publishing the list of accepted talks within 24 hours, so if
> > you can no longer give this talk, please contact me immediately so I
> > can find a replacement. If you need to make changes to your title or
> > abstract, please contact me.
>
> > We haven't yet completed the schedule, so we don't yet know whether
> > you've been allocated a 30 or a 45 minute time slot. We'll be
> > announcing the schedule shortly after the New Years, so please stay
> > tuned.
>
> > If you have particular scheduling requirements (if you plan to come to
> > PyCon late or leave early, for example), please let me know as soon as
> > possible so that I can take your requirements into account.
>
> > You should register for the conference at
> >https://us.pycon.org/2012/registration/as soon as possible; early-
> > bird registration ends January 10th, 2012.
>
> > Unlike many conferences, PyCon doesn't give free tickets to speakers,
> > nor do we cover travel expenses. We do this because PyCon is a
> > grassroots, community- organized conference and our core mission is to
> > keep costs low. Thus, we ask everybody who can afford to pay to do so.
> > However, we recognize that buying tickets and paying for travel can
> > represent a financial hardship to some, and we really want to see you
> > at PyCon! So, if you can't afford a ticket and/or travel expenses,
> > please apply for financial aid.
>
> > More information about financial aid can be found at
> >https://us.pycon.org/2012/assistance/. If you're applying, make sure
> > to mention that you're an accepted speaker.  Please contact Peter
> > Kropf (pkr...@gmail.com) if you've got any questions.
>
> > If you need assistance with visas or immigration documents, please
> > contact Rami Chowdhury (rami.chowdh...@gmail.com).
>
> > If you have any other questions, comments, or feedback, please feel
> > free to contact me (ja...@jacobian.org), my co-chair, Tim Lesher
> > (tles...@gmail.com), or the conference chair, Jesse Noller
> > (jnol...@python.org).
>
> > On behalf of the PyCon staff, I want to thank you for your submission.
> > We're really looking forward to seeing you at the conference: PyCon is
> > an amazing conference because of our amazing speakers, and we're
> > thrilled that you're one of them.
>
> > See you in Santa Clara!
>
> > Jacob Kaplan-Moss
> > PyCon 2012 Program Committee Chair
> > ja...@jacobian.org


[web2py] Re: Upload in GAE, SQLFORM.factory, multiple tables

2011-12-21 Thread howesc
i have not used the upload field on GAE (which stores data in a blob 
limited to 1mb), but i did use the techniques here: 
http://www.web2pyslices.com/slices/take_slice/63 to use blobstore for 
images.

cfh


[web2py] Many-to-many admin form

2011-12-21 Thread Bruce Wade
Hello, I know django has this ability so I am assuming web2py also does.
(Here is to hoping :D)

First the models:
db.define_table('adreports',
Field('reporttype', unique=True)
)

db.define_table('ads',
Field('member_id', db.auth_user, default=auth.user_id),
Field('points', 'integer', default=0),
Field('url'),
Field('language'),
Field('location'),
Field('accepted', 'boolean', default=False),
Field('viewable', 'boolean'),
Field('updated_at','datetime', default=request.now),
Field('added_at','datetime', default=request.now)
)

db.define_table('keywords',
Field('isapproved', 'boolean', default=False),
Field('key')
)

db.define_table('ad_report',
Field('ad_id', db.ads),
Field('reportad_id', db.adreports)
)

db.define_table('ad_keyword',
Field('ad_id', db.ads),
Field('keyword_id', db.keywords)
)

db.ads.url.requires = (IS_URL(), IS_NOT_IN_DB(db, db.ads.url))

db.ad_report.ad_id.requires = IS_IN_DB(db, db.ads.id, "%(url)s")
db.ad_report.reportad_id.requires = IS_IN_DB(db, db.adreports.id,
"%(reporttype)s")

db.ad_keyword.ad_id.requires = IS_IN_DB(db, db.ads.id, "%(url)s")
db.ad_keyword.keyword_id.requires = IS_IN_DB(db, db.keywords.id, "%(key)s")

--
Now I would like to be able, from the admin create a new ad and on the same
page add multiple keywords and/or reports for the ad. This would have to
happen with creating a new ad as well as when editing an existing ad.

With Django you use: admin.TabularInline and inlines on admin.ModelAdmin
classes
https://docs.djangoproject.com/en/dev/ref/contrib/admin/#inlinemodeladmin-objects

Has something similar being developed for web2py admin application?
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com


Re: [web2py] Bugtracker for web2py?

2011-12-21 Thread Nik Go
http://code.google.com/p/web2py/issues/entry

On Wednesday, December 21, 2011, greenguerilla wrote:

> Hi guys,
>
> I found a small error in the documentation and was looking for a
> bugtracker where I could log this.
>
> Can someone please pass me the url?
>
> Thanks,
>
> John


[web2py] Re: Computed field

2011-12-21 Thread Jose Carlos Junior
 Thank you Jim .i gonna try this as soon as possibleand
return...

On 21 dez, 18:21, Jim Steil  wrote:
> Here's what I would try:
>
> Field('difference', compute=lambda u: (u['DT_FECHAMENTO '] -
> u['DT_ABERTURA ']), label='Difference')
>
> This is untested.  I haven't used compute fields based on a math
> function before, but like I said, this is what I'd try first.
>
> Hope this helps.
>
>      -Jim
>
> On 12/21/2011 1:43 PM, Jose Carlos Junior wrote:
>
>
>
>
>
>
>
> > People,
>
> >        How can I make the field NR_INDISPONIBILIDADE the table below
> > (chamado) in a computed field with the difference between the field
> > dates DT_FECHAMENTO and DT_ABERTURA.
> >      Thank you,
>
> > db.define_table("chamados"
> >      ,Field('ID_CHAMADOS',type='id',readable=False)
> >      ,Field('ID_TECNICOS',type='integer',notnull=True,label='T cnico')
> >      ,Field('ID_CIRCUITOS',type='integer',notnull=True,label='Circuito')
> >      ,Field('NR_CHAMADO',type='string',notnull=False,label='Chamado')
> >      ,Field('DT_ABERTURA',type='datetime',notnull=True,label='Abertura')
> >      
> > ,Field('DT_FECHAMENTO',type='datetime',notnull=False,label='Fechamento')
> >      
> > ,Field('NR_INDISPONIBILIDADE',type='double',notnull=False,label='Indisponib 
> > ilidade')
> >      ,Field('FL_OFENSOR',type='boolean',label='Ofensor',default=True)
> >      ,migrate=False
> > )


Re: [web2py] Re: Need to update the twitter book example?

2011-12-21 Thread Vinicius Assef
Anthony, when you say about needing update the book, could we
understand someone is already doing that?



On 12/21/11, Anthony  wrote:
> Yeah, I had an app using the old method -- looks like Twitter recently
> dropped support for that method. I guess we should update the book.
>
> On Tuesday, December 20, 2011 6:25:19 PM UTC-5, Alan Etkin wrote:
>>
>> It seems that the get tweets example from the book (14.12) is not
>> working anymore:
>>
>> When requesting from the browser's address field this location:
>>
>> http://twitter.com/username?format=json
>>
>> The output is an html page
>>
>> I had to change the address to the twitter rest api search command:
>>
>> Here is the related documentation
>> https://dev.twitter.com/docs/api/1/get/search
>>
>> Does the current book example works for anybody?
>>
>


Re: [web2py] compute=lambda r: don't return all the fields

2011-12-21 Thread Vinicius Assef
As book says...
"DAL fields may have a compute attribute. This must be a function (or
lambda) that takes a Row object and returns a value for the field."

So, lambda for computed fields gets all fields and returns just one field.

I think it work on DAL level, not on FORM level.



On 12/19/11, Richard Vézina  wrote:
> I don't get all my db.table fields form define_table fields defined...
>
> A other guy report that... But didn't find exactly why his compute
> functions as stop working properly...
>
> To me it's related to the fact tha if I do :
>
> Field('mycomputefield', compute=lambda r: r)
>
> I am not getting all the fields.
>
> For example:
>
> db.define_table('test1',
> Field('f1','string'),
> Field('f2','integer'),
> Field('computefield',compute=lambda r: r))
>
> Will return only field that appear in form, so if I set f1 to
> writable=False, it will not be in form so it will not be available to
> compute function...
>
> I think it for make compute failed silently if some fields are set to
> writable or readable = False... But I would return all the field to compute
> with a "None" for empty field instead of not returning any key... I really
> don't know if it even possible, if it is a bug or something else...
>
> I work around issue I were having with compute (I would compute a md5 hash
> for row so I would have all key/value pairs even if one of those were
> empty, but I can't with compute), so I use the new virtual field style
> (hope it will stay).
>
> Here the thread I am refering to :
> http://groups.google.com/group/web2py/browse_thread/thread/cd6191f9827a48d5/a367c0e5055bb676?lnk=gst&q=Computed+Fields+broken+by+1.99.2#a367c0e5055bb676
>
>
> Richard
>
> On Mon, Dec 19, 2011 at 2:22 PM, Anthony  wrote:
>
>> What do you mean it doesn't return all the fields?
>>
>>
>> On Monday, December 19, 2011 10:47:42 AM UTC-5, Richard wrote:
>>>
>>> Hello,
>>>
>>> I try to use compute to generate a record md5_hash on insert and
>>> update, but I discover that compute=lambda r: don't return all the
>>> db.table fields why?
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>>
>


Re: [web2py] Fwd: PyCon 2012: Talk acceptance - web2py: ideas we stole and ideas we had

2011-12-21 Thread Ovidio Marinho
We seem to have something, Massimo, congratulations, I feel so clean
soul. I did my part, now it is with you.



       Ovidio Marinho Falcao Neto
                Web Developer
             ovidio...@gmail.com
          ovidiomari...@itjp.net.br
                 ITJP - itjp.net.br
               83   8826 9088 - Oi
               83   9334 0266 - Claro
                        Brasil

                        Apóio



2011/12/21 Massimo DiPierro :
> :-)
>
> Begin forwarded message:
>
> From: 
> Subject: PyCon 2012: Talk acceptance - web2py: ideas we stole and ideas we
> had
> Date: December 21, 2011 2:25:39 PM CST
> To: 
>
> Dear Massimo Di Pierro,
>
> I'm very pleased tell you that your talk has been accepted for PyCon
> 2012 - congratulations! Please check that the details below are
> correct, and read through this email for your next steps.
>
>    Title: web2py: ideas we stole and ideas we had
>    URL: https://us.pycon.org/2012/schedule/presentation/112/
>
> We'll be publishing the list of accepted talks within 24 hours, so if
> you can no longer give this talk, please contact me immediately so I
> can find a replacement. If you need to make changes to your title or
> abstract, please contact me.
>
> We haven't yet completed the schedule, so we don't yet know whether
> you've been allocated a 30 or a 45 minute time slot. We'll be
> announcing the schedule shortly after the New Years, so please stay
> tuned.
>
> If you have particular scheduling requirements (if you plan to come to
> PyCon late or leave early, for example), please let me know as soon as
> possible so that I can take your requirements into account.
>
> You should register for the conference at
> https://us.pycon.org/2012/registration/ as soon as possible; early-
> bird registration ends January 10th, 2012.
>
> Unlike many conferences, PyCon doesn't give free tickets to speakers,
> nor do we cover travel expenses. We do this because PyCon is a
> grassroots, community- organized conference and our core mission is to
> keep costs low. Thus, we ask everybody who can afford to pay to do so.
> However, we recognize that buying tickets and paying for travel can
> represent a financial hardship to some, and we really want to see you
> at PyCon! So, if you can't afford a ticket and/or travel expenses,
> please apply for financial aid.
>
> More information about financial aid can be found at
> https://us.pycon.org/2012/assistance/. If you're applying, make sure
> to mention that you're an accepted speaker.  Please contact Peter
> Kropf (pkr...@gmail.com) if you've got any questions.
>
> If you need assistance with visas or immigration documents, please
> contact Rami Chowdhury (rami.chowdh...@gmail.com).
>
> If you have any other questions, comments, or feedback, please feel
> free to contact me (ja...@jacobian.org), my co-chair, Tim Lesher
> (tles...@gmail.com), or the conference chair, Jesse Noller
> (jnol...@python.org).
>
> On behalf of the PyCon staff, I want to thank you for your submission.
> We're really looking forward to seeing you at the conference: PyCon is
> an amazing conference because of our amazing speakers, and we're
> thrilled that you're one of them.
>
> See you in Santa Clara!
>
> Jacob Kaplan-Moss
> PyCon 2012 Program Committee Chair
> ja...@jacobian.org
>
>


[web2py] Re: Web Development Introduction Based On Web2py

2011-12-21 Thread mikech
Bookmarked!  I like the approach as well.

Re: [web2py] Re: Fwd: PyCon 2012: Talk acceptance - web2py: ideas we stole and ideas we had

2011-12-21 Thread Khalil KHAMLICHI
World wide this time.


[web2py] Re: Fwd: PyCon 2012: Talk acceptance - web2py: ideas we stole and ideas we had

2011-12-21 Thread Alan Etkin
Nice email. Will the talk have video broadcast trough vimeo/
youtube/...?

On 21 dic, 18:09, Massimo DiPierro  wrote:
> :-)
>
> Begin forwarded message:
>
> > From: 
> > Subject: PyCon 2012: Talk acceptance - web2py: ideas we stole and ideas we 
> > had
> > Date: December 21, 2011 2:25:39 PM CST
> > To: 
>
> > Dear Massimo Di Pierro,
>
> > I'm very pleased tell you that your talk has been accepted for PyCon
> > 2012 - congratulations! Please check that the details below are
> > correct, and read through this email for your next steps.
>
> >    Title: web2py: ideas we stole and ideas we had
> >    URL:https://us.pycon.org/2012/schedule/presentation/112/
>
> > We'll be publishing the list of accepted talks within 24 hours, so if
> > you can no longer give this talk, please contact me immediately so I
> > can find a replacement. If you need to make changes to your title or
> > abstract, please contact me.
>
> > We haven't yet completed the schedule, so we don't yet know whether
> > you've been allocated a 30 or a 45 minute time slot. We'll be
> > announcing the schedule shortly after the New Years, so please stay
> > tuned.
>
> > If you have particular scheduling requirements (if you plan to come to
> > PyCon late or leave early, for example), please let me know as soon as
> > possible so that I can take your requirements into account.
>
> > You should register for the conference at
> >https://us.pycon.org/2012/registration/as soon as possible; early-
> > bird registration ends January 10th, 2012.
>
> > Unlike many conferences, PyCon doesn't give free tickets to speakers,
> > nor do we cover travel expenses. We do this because PyCon is a
> > grassroots, community- organized conference and our core mission is to
> > keep costs low. Thus, we ask everybody who can afford to pay to do so.
> > However, we recognize that buying tickets and paying for travel can
> > represent a financial hardship to some, and we really want to see you
> > at PyCon! So, if you can't afford a ticket and/or travel expenses,
> > please apply for financial aid.
>
> > More information about financial aid can be found at
> >https://us.pycon.org/2012/assistance/. If you're applying, make sure
> > to mention that you're an accepted speaker.  Please contact Peter
> > Kropf (pkr...@gmail.com) if you've got any questions.
>
> > If you need assistance with visas or immigration documents, please
> > contact Rami Chowdhury (rami.chowdh...@gmail.com).
>
> > If you have any other questions, comments, or feedback, please feel
> > free to contact me (ja...@jacobian.org), my co-chair, Tim Lesher
> > (tles...@gmail.com), or the conference chair, Jesse Noller
> > (jnol...@python.org).
>
> > On behalf of the PyCon staff, I want to thank you for your submission.
> > We're really looking forward to seeing you at the conference: PyCon is
> > an amazing conference because of our amazing speakers, and we're
> > thrilled that you're one of them.
>
> > See you in Santa Clara!
>
> > Jacob Kaplan-Moss
> > PyCon 2012 Program Committee Chair
> > ja...@jacobian.org
>
>


Re: [web2py] Adding user to a group after registration

2011-12-21 Thread Chandrakant Kumar

better version :

def __add_user_membership(form):
group_id = auth.id_group(role=form.vars.user_type)
user_id = form.vars.id
auth.add_membership(group.id,user_id)

On Thu, 22 Dec 2011 01:52:50 +0530, Anthony  wrote:


You can use an auth.settings.register_onaccept function, which could use
auth.add_membership() to add the appropriate membership for the new user.

Anthony

On Wednesday, December 21, 2011 3:00:20 PM UTC-5, Chandra wrote:



I'm attempting to add a user to a group , depending on the role he chose
 from a dropdown list.

for e.g., In the register form user is presented an option of choosing
user type 1. individual 2. organisation

how do i add the user to the appropriate group depending on his  
selection?


(i went through the group archives, and one solution was to use
request.args, but i want to use single register link)






[web2py] Re: PyCon 2012: Talk acceptance - web2py: ideas we stole and ideas we had

2011-12-21 Thread Anthony
Congratulations!

Re: [web2py] Adding user to a group after registration

2011-12-21 Thread Chandrakant Kumar
I didn't even know that existed, but that worked exactly like i wanted,  
thanks.


I thought i should post the code, if anybody in future needs it:

#controllers/default.py
def __add_user_membership(form):
group =  
db(db.auth_group.role==form.vars.user_type).select().first()

user_id = form.vars.id
auth.add_membership(group.id,user_id)
def user():
   auth.settings.register_onaccept = __add_user_membership
   # already existing code

On Thu, 22 Dec 2011 01:52:50 +0530, Anthony  wrote:


You can use an auth.settings.register_onaccept function, which could use
auth.add_membership() to add the appropriate membership for the new user.

Anthony

On Wednesday, December 21, 2011 3:00:20 PM UTC-5, Chandra wrote:



I'm attempting to add a user to a group , depending on the role he chose
 from a dropdown list.

for e.g., In the register form user is presented an option of choosing
user type 1. individual 2. organisation

how do i add the user to the appropriate group depending on his  
selection?


(i went through the group archives, and one solution was to use
request.args, but i want to use single register link)






Re: [web2py] LDAP: Mapping additional AD fields to Auth_user

2011-12-21 Thread brunoelottero


I will give this a try, i only have openldap available for testing purposes, 
but it should work for MS too.



Re: [web2py] Fwd: PyCon 2012: Talk acceptance - web2py: ideas we stole and ideas we had

2011-12-21 Thread Michele Comitini
Bravo ;-)



2011/12/21 Massimo DiPierro :
> :-)
>
> Begin forwarded message:
>
> From: 
> Subject: PyCon 2012: Talk acceptance - web2py: ideas we stole and ideas we
> had
> Date: December 21, 2011 2:25:39 PM CST
> To: 
>
> Dear Massimo Di Pierro,
>
> I'm very pleased tell you that your talk has been accepted for PyCon
> 2012 - congratulations! Please check that the details below are
> correct, and read through this email for your next steps.
>
>    Title: web2py: ideas we stole and ideas we had
>    URL: https://us.pycon.org/2012/schedule/presentation/112/
>
> We'll be publishing the list of accepted talks within 24 hours, so if
> you can no longer give this talk, please contact me immediately so I
> can find a replacement. If you need to make changes to your title or
> abstract, please contact me.
>
> We haven't yet completed the schedule, so we don't yet know whether
> you've been allocated a 30 or a 45 minute time slot. We'll be
> announcing the schedule shortly after the New Years, so please stay
> tuned.
>
> If you have particular scheduling requirements (if you plan to come to
> PyCon late or leave early, for example), please let me know as soon as
> possible so that I can take your requirements into account.
>
> You should register for the conference at
> https://us.pycon.org/2012/registration/ as soon as possible; early-
> bird registration ends January 10th, 2012.
>
> Unlike many conferences, PyCon doesn't give free tickets to speakers,
> nor do we cover travel expenses. We do this because PyCon is a
> grassroots, community- organized conference and our core mission is to
> keep costs low. Thus, we ask everybody who can afford to pay to do so.
> However, we recognize that buying tickets and paying for travel can
> represent a financial hardship to some, and we really want to see you
> at PyCon! So, if you can't afford a ticket and/or travel expenses,
> please apply for financial aid.
>
> More information about financial aid can be found at
> https://us.pycon.org/2012/assistance/. If you're applying, make sure
> to mention that you're an accepted speaker.  Please contact Peter
> Kropf (pkr...@gmail.com) if you've got any questions.
>
> If you need assistance with visas or immigration documents, please
> contact Rami Chowdhury (rami.chowdh...@gmail.com).
>
> If you have any other questions, comments, or feedback, please feel
> free to contact me (ja...@jacobian.org), my co-chair, Tim Lesher
> (tles...@gmail.com), or the conference chair, Jesse Noller
> (jnol...@python.org).
>
> On behalf of the PyCon staff, I want to thank you for your submission.
> We're really looking forward to seeing you at the conference: PyCon is
> an amazing conference because of our amazing speakers, and we're
> thrilled that you're one of them.
>
> See you in Santa Clara!
>
> Jacob Kaplan-Moss
> PyCon 2012 Program Committee Chair
> ja...@jacobian.org
>
>


[web2py] Fwd: PyCon 2012: Talk acceptance - web2py: ideas we stole and ideas we had

2011-12-21 Thread Massimo DiPierro
:-)

Begin forwarded message:

> From: 
> Subject: PyCon 2012: Talk acceptance - web2py: ideas we stole and ideas we had
> Date: December 21, 2011 2:25:39 PM CST
> To: 
> 
> Dear Massimo Di Pierro,
> 
> I'm very pleased tell you that your talk has been accepted for PyCon
> 2012 - congratulations! Please check that the details below are
> correct, and read through this email for your next steps.
> 
>Title: web2py: ideas we stole and ideas we had
>URL: https://us.pycon.org/2012/schedule/presentation/112/
> 
> We'll be publishing the list of accepted talks within 24 hours, so if
> you can no longer give this talk, please contact me immediately so I
> can find a replacement. If you need to make changes to your title or
> abstract, please contact me.
> 
> We haven't yet completed the schedule, so we don't yet know whether
> you've been allocated a 30 or a 45 minute time slot. We'll be
> announcing the schedule shortly after the New Years, so please stay
> tuned.
> 
> If you have particular scheduling requirements (if you plan to come to
> PyCon late or leave early, for example), please let me know as soon as
> possible so that I can take your requirements into account.
> 
> You should register for the conference at
> https://us.pycon.org/2012/registration/ as soon as possible; early-
> bird registration ends January 10th, 2012.
> 
> Unlike many conferences, PyCon doesn't give free tickets to speakers,
> nor do we cover travel expenses. We do this because PyCon is a
> grassroots, community- organized conference and our core mission is to
> keep costs low. Thus, we ask everybody who can afford to pay to do so.
> However, we recognize that buying tickets and paying for travel can
> represent a financial hardship to some, and we really want to see you
> at PyCon! So, if you can't afford a ticket and/or travel expenses,
> please apply for financial aid.
> 
> More information about financial aid can be found at
> https://us.pycon.org/2012/assistance/. If you're applying, make sure
> to mention that you're an accepted speaker.  Please contact Peter
> Kropf (pkr...@gmail.com) if you've got any questions.
> 
> If you need assistance with visas or immigration documents, please
> contact Rami Chowdhury (rami.chowdh...@gmail.com).
> 
> If you have any other questions, comments, or feedback, please feel
> free to contact me (ja...@jacobian.org), my co-chair, Tim Lesher
> (tles...@gmail.com), or the conference chair, Jesse Noller
> (jnol...@python.org).
> 
> On behalf of the PyCon staff, I want to thank you for your submission.
> We're really looking forward to seeing you at the conference: PyCon is
> an amazing conference because of our amazing speakers, and we're
> thrilled that you're one of them.
> 
> See you in Santa Clara!
> 
> Jacob Kaplan-Moss
> PyCon 2012 Program Committee Chair
> ja...@jacobian.org



[web2py] Re: Web Development Introduction Based On Web2py

2011-12-21 Thread kasapo
Found an error with the links in the "Complete API" section ( /api )

e.g.
http://killer-web-development.com/docstring/SQLFORM

Any request that goes to docstring seems to generate an error.

Rock on and keep those chapters coming!

On Dec 20, 12:33 pm, "ma...@rockiger.com" 
wrote:
> I published the first 3 chapters of my web development tutorial 
> athttp://killer-web-development.com
>
> It's aimed at total web development beginners and uses web2py as framework.
>
> The idea was to write a web development tutorial based on web2py, because
> web2py is the easiest
> to use web development solution - maybe I can rescue a few people from
> starting with PHP.
>
> The book aims to be an mixture of railstutorial.org and the Head First
> series. Lots of images and
> very low level subject matter. A the end readers will develop a full
> microblogging service.
>
> I would appreciate any feedback.
>
> Best
> marco


[web2py] Re: Problem with Web2py sql that includes % on Postgres; breaking New Relic

2011-12-21 Thread pbreit
Graham sent me a patched NewRelic agent (version 1.0.6.176) which appears 
to be working fine.

[web2py] Re: LDAP DAL Adapter Help

2011-12-21 Thread Bruno Lottero
I went for something like this:

DAL (
'ldap://server:port', driver_args={'dn':
'cn=admin,ou=People,dc=example,dc=com', 'password':'password'})

Ok, now i have to find out how to make define_table() to work with ldap 
tree model

Cheers.

[web2py] Re: Combine SQLFORM and SQLFORM.grid?

2011-12-21 Thread apple
I missed a bit..[I did say it was a bit fiddly!]

You still need to refresh the grid when the dialog box closes. To do
this I replaced the LOAD calls with load2 which adds a url to the
component:

def load2(**args):
""" calls LOAD and sets url attribute to enable easy refresh of
the component """
s=Storage(**args)
if s.url: url=s.url
else: url=URL(c=s.c, f=s.f, args=s.args, vars=s.vars,
extension=s.extension)
return LOAD(_url=url, **args)
###
Then in the view:

// refresh a web2py component using url attribute
function refresh(component) {
web2py_ajax_page("get", $('#'+component).attr("url"), null ,
component)
}
#
and in the controller you add "refresh('gridid')" to v._onacceptjs.

If you need to you can refresh other components in the same way e.g.
if your edit form has a count of the rows on the grid then you might
want to refresh it.

Thats it!!!

On Dec 21, 8:03 pm, apple  wrote:
> I have done something similar to what you are looking for but it was a
> little fiddly in places (if someone can suggest a better way I would
> be delighted!). My application had some extra functionality but the
> gist of it is:
>
> You have a form and a grid. You can put these on the same page easily
> using LOAD component.
>
> {{=LOAD(f='edit.load', ajax=True, args=.}}
> {{=LOAD(f='grid.load', ajax=True, args=.}}
>
> Now you have them on the same page.
>
> ###
> But when you add/edit a grid row then you have 2 forms and 2 submit
> buttons on the page which is odd. So I used a dialog box for the add/
> edit functions. This is actually quite easy as the majority of the
> code is already included in web2py.
>
> In the view you do this:
>
> // create dialogbox
> document.write("")
> $(document).ready(function(){
>         $('#dialogdiv').dialog({autoOpen : false, modal : false, width :
> 'auto'});})
>
> // open url in dialog box
> function dialog(url) {
>         web2py_ajax_page("get", url, {_newformjs:"$
> ('#dialogdiv').dialog('open')"} , 'dialogdiv')
>
> }
>
> Now if you pass any url to the javascript dialog function it will call
> the controller and open the form in a dialog box; and return any form
> errors inside the dialog box. And only half a dozen lines of code!!
>
> ###
> Now you need to make the form open and close.
>
> In the edit controller (for person) you do this:
>
> if form.process(.).accepted:
>         response.js=v._onacceptjs
>         return
> elif form.errors:
>     pass
> else:
>     response.js=v._newformjs
> 
> and in the grid controller you setup the dialog close and rewire the
> buttons
>
> def dialog(url):
>     """ returns javascript to show the view as a dialog box """
>     return "dialog("+quote(url)+"); return false;"
>
> def grid():
>     editvars['_onacceptjs']="$('#dialogdiv').dialog('close');"
>
>     links.append(lambda row: A(SPAN(_class='ui-icon ui-icon-pencil'),
>                        SPAN('Edit',_class='ui-button-
> text',_title='Edit'),
>                        _onclick=dialog(URL(editcontroller,
> vars=editvars, args=[a.tablename, row.id])),
>                        _class='ui-button-text-icon-primary',
> _id='edit'))
>
> On Dec 21, 1:54 pm, Cliff  wrote:
>
>
>
>
>
>
>
> > Remember web2py uses the term 'form' in a very specific way.
>
> > So don't think about a web2py form for CRUD operations on child
> > records.  You need a way to dynamically update the web page so it can
> > manage the child records.  Web2py provides several approaches to this
> > problem.
>
> > The image blog example in the book outlines a design approach that
> > will solve your 
> > problem.http://web2py.com/books/default/chapter/29/3#An-image-blog
>
> > Also look here for other 
> > solutions:http://web2py.com/books/default/chapter/29/11#The-ajax-functionhttp:/...
>
> > On Dec 21, 1:22 am, Martin Weissenboeck  wrote:
>
> > > Ok, thank you - I will try it.
>
> > > 2011/12/21 Nik Go 
>
> > > > Martin,
>
> > > > I have a feeling that what you're looking is "multi-form updates" (try 
> > > > to
> > > > search for that term) where a parent record (your "person") and child
> > > > record (your "cvrows") are updated simultaneously.
>
> > > > On Wednesday, December 21, 2011, Jim Steil wrote:
>
> > > >>  have you looked at SQLFORM.smartgrid?
>
> > > >>     -Jim
>
> > > >> On 12/20/2011 1:39 PM, Martin Weissenboeck wrote:
>
> > > >> Thanks for all hints, I have found some new ideas and I will try a ot 
> > > >> of
> > > >> new things.
>
> > > >> But -may I describe my problem in detail?
> > > >> There should be a website for persons  who want to apply for a job.
>
> > > >> My present solution:
> > > >> Table "person" contains name, date of birth, phone number and so on.
> > > >> Table "cv" (curriculum vitae) conta

[web2py] Re: Web Development Introduction Based On Web2py

2011-12-21 Thread kasapo
Another way of looking at it is that the user is presented with views
(or more accurately, HTML rendered from a view by a controller using
the models) but interacts with controllers. Whenever a user clicks on
an application link on a view, the browser sends a request and the
controller handles it by dispatching data to a view and sending not
the view, but rather the rendered HTML. If you have more interactive
websites with javascript and ajax calls, then you are "interacting"
with the rendered HTML or view, but even then AJAX calls to a web2py
app talk to a controller that then sends a response.

I guess it depends on what you mean by "interacts," but from the
Marco's guide, he defines interaction as the HTTP request/response
cycle (e.g. clicking on a link and asking for a resource):

"When John's customers interact with a web2py-application via a
browser, they send a request, which is received by the web server and
passsed on to a controller."

So I think the way he defines it is really best, but it's good to
discuss these things I think.

Anyway, that's just my $0.02.

Good job Marco!

I like the graphics with the "penciled in" arrows. Also I had no idea
you could get a hosted app on fluxflex for free -- that's awesome.

On Dec 21, 12:25 pm, Daniel Aguayo Catalán 
wrote:
> ma...@rockiger.com escribió:> Should go away, when all dns servers are 
> updated.
>
> Hi,
>
> athttp://killer-web-development.com/section/1/3shows a diagram that
> try to explain the MVC pattern that says:
>
> [USER <-> CONTROLLER <-> VIEW,  USER <-> CONTROLLER <-> MODEL <- DATABASE]
>
> ...but I think it should be as follows:
>
> [USER <-> VIEW <-> CONTROLLER <-> MODEL <-> DATABASE]
>
> ...because user just interact directly with Views and these make the
> request to controllers and/or models. Or am I wrong?


[web2py] GAE SQLFORM not inserting into datastore

2011-12-21 Thread Murray3
As per latest documentation:
http://web2py.com/books/default/chapter/29/13#Deployment-recipes
In model i have:
db.define_table('test',
    Field('test', 'string'),
    Field('image', 'upload'))
In controller I have:
def test():
    form = SQLFORM(db.test)
    return dict(form=form)
In view I have:
{{extend 'layout.html'}}
{{=form}}
does not insert record in to local GAE datastore, is this missing
someething? or what is missing from docs?
any feedback appreciated.

ps this is a new post as the previous thread seems to have gone awol!


[web2py] Re: Is there any "mainstream" wysiwyg html editor in web2py world?

2011-12-21 Thread Anthony

>
> CLEANUP(re.compile('', re.S|re.I)) 
>

It's not enough to exclude only 

[web2py] Re: Is there any "mainstream" wysiwyg html editor in web2py world?

2011-12-21 Thread pbreit
The state of WYSIWYG textarea editing is horrible. The big 2, TinyMCE and 
CKEditor are bloated and have lousy UI/UX. There are a zillion less bloated 
options but hardly any that are decent.

I used NicEdit which is OK but I don't think the developer is still working 
on it.


Re: [web2py] Computed field

2011-12-21 Thread Jim Steil

Here's what I would try:

Field('difference', compute=lambda u: (u['DT_FECHAMENTO '] - 
u['DT_ABERTURA ']), label='Difference')


This is untested.  I haven't used compute fields based on a math 
function before, but like I said, this is what I'd try first.


Hope this helps.

-Jim

On 12/21/2011 1:43 PM, Jose Carlos Junior wrote:

People,


   How can I make the field NR_INDISPONIBILIDADE the table below
(chamado) in a computed field with the difference between the field
dates DT_FECHAMENTO and DT_ABERTURA.
 Thank you,

db.define_table("chamados"
 ,Field('ID_CHAMADOS',type='id',readable=False)
 ,Field('ID_TECNICOS',type='integer',notnull=True,label='Técnico')
 ,Field('ID_CIRCUITOS',type='integer',notnull=True,label='Circuito')
 ,Field('NR_CHAMADO',type='string',notnull=False,label='Chamado')
 ,Field('DT_ABERTURA',type='datetime',notnull=True,label='Abertura')
 ,Field('DT_FECHAMENTO',type='datetime',notnull=False,label='Fechamento')
 
,Field('NR_INDISPONIBILIDADE',type='double',notnull=False,label='Indisponibilidade')
 ,Field('FL_OFENSOR',type='boolean',label='Ofensor',default=True)
 ,migrate=False
)


Re: [web2py] Adding user to a group after registration

2011-12-21 Thread Anthony
You can use an auth.settings.register_onaccept function, which could use 
auth.add_membership() to add the appropriate membership for the new user.

Anthony

On Wednesday, December 21, 2011 3:00:20 PM UTC-5, Chandra wrote:
>
>
> I'm attempting to add a user to a group , depending on the role he chose  
>  from a dropdown list.
>
> for e.g., In the register form user is presented an option of choosing  
> user type 1. individual 2. organisation
>
> how do i add the user to the appropriate group depending on his selection? 
>  
> (i went through the group archives, and one solution was to use  
> request.args, but i want to use single register link)
>
>

[web2py] Re: Combine SQLFORM and SQLFORM.grid?

2011-12-21 Thread apple
I have done something similar to what you are looking for but it was a
little fiddly in places (if someone can suggest a better way I would
be delighted!). My application had some extra functionality but the
gist of it is:

You have a form and a grid. You can put these on the same page easily
using LOAD component.

{{=LOAD(f='edit.load', ajax=True, args=.}}
{{=LOAD(f='grid.load', ajax=True, args=.}}

Now you have them on the same page.

###
But when you add/edit a grid row then you have 2 forms and 2 submit
buttons on the page which is odd. So I used a dialog box for the add/
edit functions. This is actually quite easy as the majority of the
code is already included in web2py.

In the view you do this:

// create dialogbox
document.write("")
$(document).ready(function(){
$('#dialogdiv').dialog({autoOpen : false, modal : false, width :
'auto'});
})
// open url in dialog box
function dialog(url) {
web2py_ajax_page("get", url, {_newformjs:"$
('#dialogdiv').dialog('open')"} , 'dialogdiv')
}

Now if you pass any url to the javascript dialog function it will call
the controller and open the form in a dialog box; and return any form
errors inside the dialog box. And only half a dozen lines of code!!

###
Now you need to make the form open and close.

In the edit controller (for person) you do this:

if form.process(.).accepted:
response.js=v._onacceptjs
return
elif form.errors:
pass
else:
response.js=v._newformjs

and in the grid controller you setup the dialog close and rewire the
buttons

def dialog(url):
""" returns javascript to show the view as a dialog box """
return "dialog("+quote(url)+"); return false;"

def grid():
editvars['_onacceptjs']="$('#dialogdiv').dialog('close');"

links.append(lambda row: A(SPAN(_class='ui-icon ui-icon-pencil'),
   SPAN('Edit',_class='ui-button-
text',_title='Edit'),
   _onclick=dialog(URL(editcontroller,
vars=editvars, args=[a.tablename, row.id])),
   _class='ui-button-text-icon-primary',
_id='edit'))




On Dec 21, 1:54 pm, Cliff  wrote:
> Remember web2py uses the term 'form' in a very specific way.
>
> So don't think about a web2py form for CRUD operations on child
> records.  You need a way to dynamically update the web page so it can
> manage the child records.  Web2py provides several approaches to this
> problem.
>
> The image blog example in the book outlines a design approach that
> will solve your 
> problem.http://web2py.com/books/default/chapter/29/3#An-image-blog
>
> Also look here for other 
> solutions:http://web2py.com/books/default/chapter/29/11#The-ajax-functionhttp://web2py.com/books/default/chapter/29/12#Components
>
> On Dec 21, 1:22 am, Martin Weissenboeck  wrote:
>
>
>
>
>
>
>
> > Ok, thank you - I will try it.
>
> > 2011/12/21 Nik Go 
>
> > > Martin,
>
> > > I have a feeling that what you're looking is "multi-form updates" (try to
> > > search for that term) where a parent record (your "person") and child
> > > record (your "cvrows") are updated simultaneously.
>
> > > On Wednesday, December 21, 2011, Jim Steil wrote:
>
> > >>  have you looked at SQLFORM.smartgrid?
>
> > >>     -Jim
>
> > >> On 12/20/2011 1:39 PM, Martin Weissenboeck wrote:
>
> > >> Thanks for all hints, I have found some new ideas and I will try a ot of
> > >> new things.
>
> > >> But -may I describe my problem in detail?
> > >> There should be a website for persons  who want to apply for a job.
>
> > >> My present solution:
> > >> Table "person" contains name, date of birth, phone number and so on.
> > >> Table "cv" (curriculum vitae) contains for each person zero or more rows.
> > >> Each row consists of the dates of the start and the end of the occupation
> > >> and some details about the occupation.
>
> > >> Page one is a SQLFORM of table "person" with a submit button. If the form
> > >> is filled without errors the user is redirected to the second page. There
> > >> is a SQLFORM.grid of table "cv" on this page. Of course person.id from
> > >> page one is used on page two. Page two has it's own submit button.
>
> > >> My question:
> > >> It would be nice to have both forms (the form for the person and the form
> > >> for some rows of cv) on one page with only one submit button. Is there 
> > >> any
> > >> way to concatanate these two forms?
>
> > >>  2011/12/19 Cliff 
>
> > >>> Martin,
> > >>> There has been discussion about manipulating grid.  Search for threads
> > >>> containing form.create()
>
> > >>> Also perhaps Anthony will chime in.  He knows this stuff pretty well.
>
> > >>> apple,
> > >>> > Surely the grid is just a grid and does not have a submit button?
>
> > >>>  SQLFORM.grid is much more than that.
>
> > >>>http://web2py.com/books/default/chapter/29/7#SQLFORM.grid-and-SQLFORM...)
>
> > >>> On Dec 19, 9:48 am,

[web2py] Re: Linking to uploaded files (when using separate folders)

2011-12-21 Thread Anthony
It's tricky, but everything you need is in the encoded filename. With 
uploadseparate=True, the file is stored in a subfolder named 
/table.field/[first 2 characters of filename uuid]. Try something like this:

sub = file.split('.')
url = URL('static', 'userpics/%s.%s/%s/%s' % (sub[0], sub[1], sub[2][:2], 
file) )

Anthony

On Wednesday, December 21, 2011 2:29:15 PM UTC-5, Yarin wrote:
>
>
> I was trying trying to bypass the download function and use a static 
> link 
>
> According to Massimo: 
> "In 'uploads' if you need authorization. In 'static' if you do not. In 
> the latter you do not need to worry about 
> authorization and you can let the web server by-pass web2py" 
>
> I actually think the download link will work for me in this case, but 
> was wondering how it could be done for static links. 
>
>
> On Dec 21, 1:18 pm, Adi  wrote: 
> > wouldn't this bring exactly the path where you store it: 
> >  > width="100px"  alt="some text" /> 
> > 
> > maybe i'm missing the mark?



[web2py] Adding user to a group after registration

2011-12-21 Thread Chandrakant Kumar


I'm attempting to add a user to a group , depending on the role he chose  
from a dropdown list.


for e.g., In the register form user is presented an option of choosing  
user type 1. individual 2. organisation


how do i add the user to the appropriate group depending on his selection?  
(i went through the group archives, and one solution was to use  
request.args, but i want to use single register link)


Re: [web2py] Re: web2py on github

2011-12-21 Thread Willoughby
Short Answer: Because that's what the developers wanted and agreed to.

Search the web2py-developer group for the months long discussion on 
changing it if you "really want to know"



On Wednesday, December 21, 2011 10:20:38 AM UTC-5, Daniel Aguayo wrote:
>
> I know that web2py doesn't need a private project option, but since 
> bitbucket is also free and support git, has issue tracker, wiki, etc, 
> why use github? I really want to know...
>
>
>

[web2py] Computed field

2011-12-21 Thread Jose Carlos Junior
People,


  How can I make the field NR_INDISPONIBILIDADE the table below
(chamado) in a computed field with the difference between the field
dates DT_FECHAMENTO and DT_ABERTURA.
Thank you,

db.define_table("chamados"
,Field('ID_CHAMADOS',type='id',readable=False)
,Field('ID_TECNICOS',type='integer',notnull=True,label='Técnico')
,Field('ID_CIRCUITOS',type='integer',notnull=True,label='Circuito')
,Field('NR_CHAMADO',type='string',notnull=False,label='Chamado')
,Field('DT_ABERTURA',type='datetime',notnull=True,label='Abertura')
,Field('DT_FECHAMENTO',type='datetime',notnull=False,label='Fechamento')

,Field('NR_INDISPONIBILIDADE',type='double',notnull=False,label='Indisponibilidade')
,Field('FL_OFENSOR',type='boolean',label='Ofensor',default=True)
,migrate=False
)


Re: [web2py] Need help hiding inactive records from smartgrid

2011-12-21 Thread Jim Steil
Right, but you can pass a query along in the constraints argument.  Here 
is a sample pulled from one of my apps:


#  Build query
if searchText and searchText .strip() != '':
queries.append(db.asset.description.contains(searchText))
if assetTypeId and assetTypeId > 0:
queries.append(db.asset.assetTypeId==assetTypeId)
if len(queries) > 0:
query = reduce(lambda a,b:(a&b),queries)
constraints={'asset':query}

#  Setup search forms
searchForms = {'asset':assetSearch}

grid = SQLFORM.smartgrid(db.asset, fields=fields,
 constraints=constraints, orderby=orderby,
 create=create, details=details,
 editable=editable, deletable=deletable,
 csv=False, 
search_widget={'asset':assetSearch},

 searchable=True,
 paginate=15, maxtextlength=45)

-Jim


On 12/21/2011 12:20 PM, Cliff wrote:

In business applications it is generally a bad idea to delete records
of purchases, sales, etc.

At the same time you want indexes to include records of active things,
such as active customers.

A simple way to manage this requirement is to use an is_active boolean
field.  Then in your index function your query includes
is_active==True.   Additionally you would have a function called
"trash" where is_active==False.

My problem is I want to use smartgrid and smartgrid doesn't accept
queries.

One solution is to have, for example, a "customers" table and an
"inactive_customers" table and move record from table to table.

Surely someone can suggest a better way.

Any and all suggestions gratefully accepted.

Thanks,
Cliff Kachinske


[web2py] Re: SQLFORM doesn't render attributes adjusted after form creation

2011-12-21 Thread Anthony
That method will work in general, but not with form.custom.begin and 
form.custom.end specifically. I guess we should make that clear in the book.

Anthony

On Wednesday, December 21, 2011 1:44:03 PM UTC-5, viniciusban wrote:
>
> In web2py book, on chapter FORMS and VALIDATORS, section Forms and
> Validators, it's written:
>
> ---
> FORM and SQLFORM are helpers and they can be manipulated in as similar
> way as the DIV. For example you can set a form style:
>
> 1. form = SQLFORM(..)
> 2. form['_style']='border:1px solid black'
> ---
>
> I'm using this very way to set "_class" attribute and custom form to
> show my form.
>
> So, in my view I have:
> {{=form.custom.begin}}
> {{=form.custom.label.nome}} {{=form.custom.widget.nome}} 
> {{=form.custom.end}}
>
> But the "_class" attribute isn't rendered.
> I did a code trace and discovered the _xml() method is called at form
> creation time. This way, the "_class" attribute is there, inside my
> form instance, but it isn't showed in my view.
>
> Is it a bug or a book mistake?
> How can I use it?
>
> --
> Vinicius Assef.
>
>

[web2py] Re: Linking to uploaded files (when using separate folders)

2011-12-21 Thread Yarin

I was trying trying to bypass the download function and use a static
link

According to Massimo:
"In 'uploads' if you need authorization. In 'static' if you do not. In
the latter you do not need to worry about
authorization and you can let the web server by-pass web2py"

I actually think the download link will work for me in this case, but
was wondering how it could be done for static links.


On Dec 21, 1:18 pm, Adi  wrote:
> wouldn't this bring exactly the path where you store it:
>  width="100px"  alt="some text" />
>
> maybe i'm missing the mark?


[web2py] Re: Linking to uploaded files (when using separate folders)

2011-12-21 Thread Yarin
@Adi- you're right- I was trying trying to bypass the download
function and use a static link, but now that you mention it I don't
see why I'd need to- this works fine- thanks.

On Dec 21, 1:18 pm, Adi  wrote:
> wouldn't this bring exactly the path where you store it:
>  width="100px"  alt="some text" />
>
> maybe i'm missing the mark?


[web2py] Re: Is there any "mainstream" wysiwyg html editor in web2py world?

2011-12-21 Thread Ray (a.k.a. Iceberg)
Hi LightDot,

Thanks for the remind. Actually WYMeditor was on my radar. I love its
clean output code philosophy. However its default look-and-feel could
surprise my end users, I am afraid. For example, those heading
1/2/3/.../6 containers look scary red when editing, although they look
"normal" again when previewing. See 
http://files.wymeditor.org/wymeditor/trunk/src/examples/01-basic.html

Maybe WYMeditor does this on purpose, but I expect an editing
experience would be less surprising to end users. (The least-
surprising rule when designing a UI.)

That said, I think that is "just" a css issue. So if someday I found a
handy css for it, then I would fall in love with WYMeditor.

Regards,
Ray

On Dec 22, 1:45 am, LightDot  wrote:
> I agree, most of the better known editors are bloated. I try to keep away
> if I can, especially from tiny and ckeditor. I haven't used elrte before,
> it seems a bit better. I have used jHtmlArea on a couple of projects with
> success, but lately I prefer WYMeditor. The .js is about 120kb minified,
> though, so still way bigger that jHtmlArea.
>
> It's a strict XHTML WYSIWYM editor (not WYSIWYG, looks even better as far
> as I'm concerned). It needs a bit of UI polishing, but it produces great
> code. If anyone tries it out, I strongly suggest using the latest beta
> releases or the code from the repo. Old stable releases are pretty stale.
>
> https://github.com/wymeditor/wymeditor


[web2py] SQLFORM doesn't render attributes adjusted after form creation

2011-12-21 Thread Vinicius Assef
In web2py book, on chapter FORMS and VALIDATORS, section Forms and
Validators, it's written:

---
FORM and SQLFORM are helpers and they can be manipulated in as similar
way as the DIV. For example you can set a form style:

1. form = SQLFORM(..)
2. form['_style']='border:1px solid black'
---

I'm using this very way to set "_class" attribute and custom form to
show my form.

So, in my view I have:
{{=form.custom.begin}}
{{=form.custom.label.nome}} {{=form.custom.widget.nome}} 
{{=form.custom.end}}

But the "_class" attribute isn't rendered.
I did a code trace and discovered the _xml() method is called at form
creation time. This way, the "_class" attribute is there, inside my
form instance, but it isn't showed in my view.

Is it a bug or a book mistake?
How can I use it?

--
Vinicius Assef.


Re: [web2py] Re: From csv to web2py-model

2011-12-21 Thread Johann Spies
On 21 December 2011 17:38, Anthony  wrote:

> You might also find this useful (perhaps could incorporate with
> model_from_csv to identify more field types automatically):
> http://code.google.com/p/csvstudio/
>
>
> Thanks.

Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)


[web2py] Re: Is there any "mainstream" wysiwyg html editor in web2py world?

2011-12-21 Thread Ray (a.k.a. Iceberg)
The idea of uploading image to external and free server is clever! I
love this idea!

However your demo link does not work for uploading image.

By the way, your upload feature is based on swf? So your site won't
support ipad/iphone user?

And what do you mean "works fine ... except ie"? Do you mean the
entire ie family is not supported? That is not a good news :-/

Hope to see your finished doc and demo soon.

Regards,
Ray

On Dec 22, 1:53 am, Vasile Ermicioi  wrote:
> I am developing one, I already use it on production, for a cms and for a
> forum.
> Works fine on all browsers except ie :(
> Planning for next weeks to make a page with docs and to fix ie bugs.
>
> A few features that I am proud of:
> - inserting html (e.g for inserting code of a embedded video from youtube)
> - automatic resize to a given width and height (via flash)  and upload to
> imgur
>
> You will see that it is quite advanced and its js+html+css is less than 50
> kb and that without minifying.
> ~ 120kb with icons and swf that uploads to imgur, but requires jquery. I
> use jquery stored on google cdn
>
> About imgur uploader:
> - it resizes and converts  to png or jpg
> - images become smaller  - e.g if you have a 1Mb image and you have set to
> be resized to 800x800 it will be ~ 100kb after uploading.
> - your image is stored to an external server for free - imgur.com
>
> take a look and if someone is interested I can help you to include it in
> your pageshttp://fermer.md/fermer/static/bolteditor/index.html
>
> ideas and comments are wellcom


Re: [web2py] Web Development Introduction Based On Web2py

2011-12-21 Thread Daniel Aguayo Catalán

ma...@rockiger.com escribió:
Should go away, when all dns servers are updated. 

Hi,

at http://killer-web-development.com/section/1/3 shows a diagram that 
try to explain the MVC pattern that says:


[USER <-> CONTROLLER <-> VIEW,  USER <-> CONTROLLER <-> MODEL <- DATABASE]


...but I think it should be as follows:

[USER <-> VIEW <-> CONTROLLER <-> MODEL <-> DATABASE]

...because user just interact directly with Views and these make the 
request to controllers and/or models. Or am I wrong?




[web2py] Need help hiding inactive records from smartgrid

2011-12-21 Thread Cliff
In business applications it is generally a bad idea to delete records
of purchases, sales, etc.

At the same time you want indexes to include records of active things,
such as active customers.

A simple way to manage this requirement is to use an is_active boolean
field.  Then in your index function your query includes
is_active==True.   Additionally you would have a function called
"trash" where is_active==False.

My problem is I want to use smartgrid and smartgrid doesn't accept
queries.

One solution is to have, for example, a "customers" table and an
"inactive_customers" table and move record from table to table.

Surely someone can suggest a better way.

Any and all suggestions gratefully accepted.

Thanks,
Cliff Kachinske


[web2py] Re: Linking to uploaded files (when using separate folders)

2011-12-21 Thread Adi
wouldn't this bring exactly the path where you store it:


maybe i'm missing the mark?



Re: [web2py] Re: Is there any "mainstream" wysiwyg html editor in web2py world?

2011-12-21 Thread LightDot
Well, jQuery is neded by web2py anyway.


Re: [web2py] Re: Is there any "mainstream" wysiwyg html editor in web2py world?

2011-12-21 Thread Vasile Ermicioi
just noticed that "9kb" jHtmlArea also uses jquery,
so it is 9kb + size of jquery


Re: [web2py] Re: Is there any "mainstream" wysiwyg html editor in web2py world?

2011-12-21 Thread Vasile Ermicioi
I am developing one, I already use it on production, for a cms and for a
forum.
Works fine on all browsers except ie :(
Planning for next weeks to make a page with docs and to fix ie bugs.

A few features that I am proud of:
- inserting html (e.g for inserting code of a embedded video from youtube)
- automatic resize to a given width and height (via flash)  and upload to
imgur

You will see that it is quite advanced and its js+html+css is less than 50
kb and that without minifying.
~ 120kb with icons and swf that uploads to imgur, but requires jquery. I
use jquery stored on google cdn

About imgur uploader:
- it resizes and converts  to png or jpg
- images become smaller  - e.g if you have a 1Mb image and you have set to
be resized to 800x800 it will be ~ 100kb after uploading.
- your image is stored to an external server for free - imgur.com

take a look and if someone is interested I can help you to include it in
your pages
http://fermer.md/fermer/static/bolteditor/index.html

ideas and comments are wellcom


[web2py] Re: how to present rows in multiple pages

2011-12-21 Thread lyn2py
I was wondering... pagination is a very common task on webpages, is
there a reason why it isn't included in web2py (and requires a plugin
or hardcoding)?

Thanks!

On Dec 22, 12:00 am, Omi Chiba  wrote:
> You can also use the plugin.http://dev.s-cubism.com/plugin_paginator
>
> I use both SQLFORM.grid and this plugin depending on if the id filed
> is available on the table.
>
> On Dec 21, 9:39 am, thodoris  wrote:
>
>
>
>
>
>
>
> > I have a query that returns many (45) results and i want to l present
> > 10 rows per page and have links at the bottom with the page numbers
> > (1,2,3,4,5 and maybe a button next or previews). How can i implement
> > this in web2py?
>
> > Thnx


[web2py] Re: Is there any "mainstream" wysiwyg html editor in web2py world?

2011-12-21 Thread LightDot
I agree, most of the better known editors are bloated. I try to keep away 
if I can, especially from tiny and ckeditor. I haven't used elrte before, 
it seems a bit better. I have used jHtmlArea on a couple of projects with 
success, but lately I prefer WYMeditor. The .js is about 120kb minified, 
though, so still way bigger that jHtmlArea.

It's a strict XHTML WYSIWYM editor (not WYSIWYG, looks even better as far 
as I'm concerned). It needs a bit of UI polishing, but it produces great 
code. If anyone tries it out, I strongly suggest using the latest beta 
releases or the code from the repo. Old stable releases are pretty stale. 

https://github.com/wymeditor/wymeditor


[web2py] Re: commenting out lines in views

2011-12-21 Thread Jim Gregory
I'm mainly testing some changes to the template and not sure if I want
to keep them or not.  Guess I'll take your advice and just keep each
copy in version control, and roll back to previous versions as
necessary.

-Jim

On Dec 21, 9:44 am, Anthony  wrote:

> On Wednesday, December 21, 2011 6:58:42 AM UTC-5, Jim Gregory wrote:
>
> > Thanks for the helpful clarification!  However, neither method will
> > work if there is web2py template code embedded inside the comment,
> > e.g.:
>
> > {{'''
> > This is my title: {{=response.title}}
> > '''}}
>
> > returns an "EOF while scanning triple-quoted string literal" error.
> > Is there a method to comment out blocks like these?
>
> If you're not using that code, why don't you just delete it?


Re: [web2py] Re: error: ('IS_IN_SET' object has no attribute 'startswith')

2011-12-21 Thread Chandrakant Kumar

ah, that was silly of me, thank you for the correction.

On Wed, 21 Dec 2011 22:39:29 +0530, DenesL  wrote:




On Dec 21, 11:41 am, "Chandrakant Kumar" 
wrote:

I'm passing a tuple of strings to IS_IN_SET validator, but i'm getting
this error -

('IS_IN_SET' object has no attribute
'startswith')

code is - Field('state', IS_IN_SET(STATE_LIST)),


Field('state', requires = IS_IN_SET(STATE_LIST)),

you are missing the 'requires' parameter name and Field is trying to
interpret the tuple as the field type.



where STATE_LIST is a tuple of strings.
--
Using Opera's revolutionary email client:http://www.opera.com/mail/





[web2py] Re: Is there any "mainstream" wysiwyg html editor in web2py world?

2011-12-21 Thread Ray (a.k.a. Iceberg)
Anthony, thank you for your input. And thank you too, Ross.

I did some evaluation in these days. Now I gonna share my thoughts.

elrte and ckeditor and tinymce etc. are definitely feature-riched, at
the same time somwhat bloated. Each sizes 135KB, 355KB, 203KB,
respectively. (How could this be called "tiny-something"? So ironic.)

After I notice the fact that, end user can (and very likely to) copy
formatted text from the popular MS WORD document, then paste into any
wysiwyg editor, I decide to choose some lightweight editor which only
provided some basic features. Oh, I don't need upload-image feature so
far.

Right now I am happy with the 9KB js jhtmlarea (http://pietschsoft.com/
demo/jHtmlArea/). Another similar option is 8KB tinyeditor (http://
www.scriptiny.com/2010/02/javascript-wysiwyg-editor/), but it is less
polished.

One caveat. When using such kind of html editors, end user could input
javascript code, which I consider potentially harmful. So we will need
something similar to this in our model:

Field('content', 'text', requires=CLEANUP(''))

But that is still not good enough. To Massimo, if you are reading this
thread, CLEANP(...) should be improved to support this syntax:

CLEANUP(re.compile('', re.S|re.I))

Regards,
Ray

On Dec 20, 3:20 am, Anthony  wrote:
> It shouldn't be too difficult to use any JS editor with web2py, but here
> are some web2py specific plugins:
>
> https://bitbucket.org/PhreeStyle/web2py_ckeditor/srchttp://dev.s-cubism.com/plugin_elrte_widgethttp://dev.s-cubism.com/plugin_managed_html/page1/_managed_html_preview
>
> Anthony
>
>
>
>
>
>
>
> On Monday, December 19, 2011 1:23:16 PM UTC-5, Ray (a.k.a. Iceberg) wrote:
>
> > Hi folks,
>
> > I used web2py for years but never have a need to use wysiwyg html
> > editor in my projects. Until recently. Then I surprisingly find no
> > "mainstream" editor mentioned in web2py world. Of course I can go with
> > any editor I will run into, but before that I just want to hear some
> > suggestion from those been-there-done-that people. Any thoughts,
> > gentlemen?
>
> > Regards,
> > Ray
>
> > PS: candidates I found.
>
> > 1. the plugin_wiki of web2py uses elrte (http://elrte.ru/en), which
> > has most powerful feature I even seen
>
> > 2. I saw this one in an unfamous web2py app, jhtmlarea. It is
> > lightweight. (http://pietschsoft.com/demo/jHtmlArea/)
>
> > 3. jwysiwyg mentioned in a web2pyslice
> >http://www.web2pyslices.com/slices/take_slice/54
>
> > 4. This sounds cool. "WYSIWYG editor with integrated image upload
> > Options"http://www.web2pyslices.com/main/slices/take_slice/18


[web2py] Re: error: ('IS_IN_SET' object has no attribute 'startswith')

2011-12-21 Thread DenesL


On Dec 21, 11:41 am, "Chandrakant Kumar" 
wrote:
> I'm passing a tuple of strings to IS_IN_SET validator, but i'm getting
> this error -
>
> ('IS_IN_SET' object has no attribute
> 'startswith')
>
> code is - Field('state', IS_IN_SET(STATE_LIST)),

Field('state', requires = IS_IN_SET(STATE_LIST)),

you are missing the 'requires' parameter name and Field is trying to
interpret the tuple as the field type.

>
> where STATE_LIST is a tuple of strings.
> --
> Using Opera's revolutionary email client:http://www.opera.com/mail/


Re: [web2py] Web Development Introduction Based On Web2py

2011-12-21 Thread ma...@rockiger.com
Should go away, when all dns servers are updated.

[web2py] Re: Web Development Introduction Based On Web2py

2011-12-21 Thread ma...@rockiger.com
Maybe a view dns server do not know about the domain. The domain is hosted 
in Germany and the website on Fluxflex (this means Amazon cloud?).

Re: [web2py] Web Development Introduction Based On Web2py

2011-12-21 Thread ma...@rockiger.com
actually it is a problem with markmin plugin, it kills the ~

[web2py] Linking to uploaded files (when using separate folders)

2011-12-21 Thread Yarin
I have an image table, modified from the image_blog example, like
this:

db.define_table('image',
   Field('title', unique=True),
   Field('file', 'upload',
   uploadfolder=os.path.join(request.folder,'static/userpics'),
   uploadseparate=True)
)

I want to be able to generate a static link to the image, but have no
way of knowing which folder the image has been inserted into. How
would you do this?


Re: [web2py] Re: Web-page freezes on db.define_table

2011-12-21 Thread Adnan Smajlovic
Can they be recreated if they get lost/corrupted through fake_migrate=True?

On Wed, Dec 21, 2011 at 8:16 AM, Johann Spies wrote:

> On 21 December 2011 15:04, Axel  wrote:
>
>> It must have been the files in web2py/applications//database/. I
>> will
>> remember to try this if the problem occurs again.
>>
>> Dropping the table might not be an option in the future...
>>
>>
> Be careful with those files.  If you delete the wrong ones you may have
> serious problems.
>
> I only delete them when the related table is no longer there.
>
>
> Regards
> Johann
>
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>
>


Re: [web2py] Web Development Introduction Based On Web2py

2011-12-21 Thread ma...@rockiger.com
Thats a typo, it should be* *~* for editor backup files.

Thank you


[web2py] error: ('IS_IN_SET' object has no attribute 'startswith')

2011-12-21 Thread Chandrakant Kumar


I'm passing a tuple of strings to IS_IN_SET validator, but i'm getting  
this error -


('IS_IN_SET' object has no attribute  
'startswith')


code is - Field('state', IS_IN_SET(STATE_LIST)),

where STATE_LIST is a tuple of strings.
--
Using Opera's revolutionary email client: http://www.opera.com/mail/


[web2py] Re: Upload in GAE, SQLFORM.factory, multiple tables

2011-12-21 Thread Murray3


On Dec 21, 1:44 pm, Murray3  wrote:
> reply to post not showing in group?
> anyway if any ideas to below problem, help appreciated.
>
>
>
> > wrote:
> > As per latest 
> > documentation:http://web2py.com/books/default/chapter/29/13#Deployment-recipes
> > In model i have:
> > db.define_table('test',
> >     Field('test', 'string'),
> >     Field('image', 'upload'))
>
> > In controller I have:
> > def test():
> >     form = SQLFORM(db.test)
> >     return dict(form=form)
>
> > In view I have:
> > {{extend 'layout.html'}}
> > {{=form}}
>
> > does not load image to local GAE datastore, is this missing
> > someething? or what is missing from docs?
> > any feedback appreciated.
>
> > On Dec 20, 8:12 pm, Massimo Di Pierro 
> > wrote:
>
> > > where is the typo? which file?
>
> > > On Nov 19, 10:04 am, Bruno Rocha  wrote:
>
> > > > On Sat, Nov 19, 2011 at 2:02 PM, Bruno Rocha  
> > > > wrote:
> > > > > *if request.env.web2py_runtime_gae: *
>
> > > > this was a typo when writing the email, actually is
>
> > > > *if **NOT** request.env.web2py_runtime_gae:*


Re: [web2py] Re: Overriding Grid/Smartgrid's 'Edit/Delete/View'

2011-12-21 Thread Adnan Smajlovic
Great. works perfect! Thanks a lot.

On Tue, Dec 20, 2011 at 10:14 PM, Cliff  wrote:

> You can learn more here:
>
>
> http://web2py.com/books/default/chapter/29/7#SQLFORM.grid-and-SQLFORM.smartgrid-(experimental)
>
> On Dec 20, 8:57 pm, Jim Steil  wrote:
> > Yes, you can pass a list of the tables you want to display through the
> > linked_tables parameter.
> >
> > grid = SQLFORM.smartgrid(db.customer, linked_tables=['note', 'order'])
> >
> > Then it will only include buttons for the tables you've listed.
> >
> >  -Jim
> >
> > On 12/20/2011 7:08 PM, Adi wrote:
> >
> >
> >
> >
> >
> >
> >
> > > is it possible to remove some of the related tables' buttons?
> >
> > > No virus found in this message.
> > > Checked by AVG -www.avg.com
> > > Version: 2012.0.1890 / Virus Database: 2109/4693 - Release Date:
> 12/20/11
>



-- 

Thanks,
Adnan

video: http://vimeo.com/24653283


Re: [web2py] Re: generating PDF invoices

2011-12-21 Thread Adnan Smajlovic
Thanks Cliff. Will look into PDF creation.

On Tue, Dec 20, 2011 at 10:18 PM, Cliff  wrote:

> The browser controls the content of those headers and footers,
> according to user settings.
>
> I don't think there is a way to override it.
>
> If you want total control you need to present a pdf.
>
> On Dec 20, 5:36 pm, Adi  wrote:
> > I'm also trying to figure out the best way to print invoices from a view.
> > My problem is a url at the bottom of a document, which is sent by a
> > browser.
> >
> > In one of the threads someone suggested to remove this line: a:after {
> > content: " (" attr(href) ")"; } from base.css, and I did, but I still see
> > the url, and a page number.
> >
> > Anyone knows a way to avoid this?
> >
> > Thanks,
> > Adi
>



-- 

Thanks,
Adnan

video: http://vimeo.com/24653283


[web2py] Re: How to show uploaded file as a link in View ?

2011-12-21 Thread Anthony
On Wednesday, December 21, 2011 5:54:43 AM UTC-5, Rahul wrote:
>
> form = crud.create(db.updates) 
> if form.accepts(request.vars, session):
>

FYI, crud.create() automatically handles the form processing, so you do not 
need to do form.accepts() when using Crud (only when using FORM or SQLFORM 
directly).
 

> Query - How do I serialize the view to show a link to files attached. 
> For example in above code, it should show me the file name (original 
> would be good or a general name like say - FILE ) as hyperlink to 
> download the same.  With the current code it shows me only the name of 
> the encoded file and does not allow me to download (i.e no links)
>

If you want to show the filename, it might be easiest to store it 
separately -- 
see http://web2py.com/books/default/chapter/29/7#Storing-the-original-filename. 
Alternatively, you can manually decode it from the encoded filename, which 
is of the form table.field.[16 char uuid].[b16encoded filename].[extension].

To create a link, you can use the download() function (or if you have 
uploaded to the static folder, you can directly link to the file). There 
are ways to automatically link to files in update/view forms -- 
see http://web2py.com/books/default/chapter/29/7#SQLFORM-and-uploads, 
http://web2py.com/books/default/chapter/29/3#An-image-blog.

Anthony
 


[web2py] Re: how to present rows in multiple pages

2011-12-21 Thread Omi Chiba
You can also use the plugin.
http://dev.s-cubism.com/plugin_paginator

I use both SQLFORM.grid and this plugin depending on if the id filed
is available on the table.

On Dec 21, 9:39 am, thodoris  wrote:
> I have a query that returns many (45) results and i want to l present
> 10 rows per page and have links at the bottom with the page numbers
> (1,2,3,4,5 and maybe a button next or previews). How can i implement
> this in web2py?
>
> Thnx


  1   2   >