[web2py:18235] Only allowing gif, png or jpeg images for upload?
How would I only allow gif, png or jpeg images to be uploaded? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18293] Re: Only allowing gif, png or jpeg images for upload?
I think Farrell's approach is the best with the Proc and PIPE method. The file name extension is in no way secure at all. Thanks for the responses guys. On Mar 18, 11:00 am, AchipA wrote: > Not web2py, but generic python: > > import mimetypes > mimetypes.guess_type(filename) > > On Mar 18, 9:05 am, Michal Jursa wrote: > > > Is it possible to get mime-type of the uploaded object in some web2py > > manner? It would be better to work with mime-type then some letters in > > filename I think. > > > Mike alias Plysak :) > > > mdipierro wrote: > > > class IS_GIF: > > > def __init__(self,em): self.em=em > > > def __call__(self,value): > > > if value and value.filename[-4:].lower()!='.gif': > > > return (value,self.em) > > > return (value,None) > > > > db.table.field.requires=IS_GIF() > > > > On Mar 17, 7:45 pm, TheDude wrote: > > >> How would I only allow gif, png or jpeg images to be uploaded? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18703] Re: Pycon 2009 - Important
Let us know how it goes! :) Will there be a summary follow up? :D On Mar 28, 9:27 am, mdipierro wrote: > See you at the web2py booth after Guido's talk today. (free hats) > > Please attend the web2py Dojo tonight at 6pm in the Open Space. > > Massimo > > On Mar 28, 12:00 am, Steve Shepherd wrote: > > > Hey you guys you need to setup a WebCam on the Stand so all of us guys that > > are stuck around the world can tune in!!! > > > Hope your converting heaps of Python guru's over to the Web2py > > > > > Steve Shepherd > > Mob:+64 (0) 27 4338154 > > Email: sargs...@gmail.com > > Analyst > > > On Sat, Mar 28, 2009 at 5:33 PM, Yarko Tymciurak wrote: > > > On Fri, Mar 27, 2009 at 11:32 PM, Yarko Tymciurak > > > wrote: > > > >> On Fri, Mar 27, 2009 at 10:59 PM, Pai wrote: > > > >>> humm where are you guys in pycon?? I walked around today and couldn't > > >>> find you > > > >> I've been walking around - Massimo has a booth in the vendors area > > >> (tomorrow there will be food there to draw people) - we were there this > > >> afternoon. > > > >> Also, tomorrow Massimo is going to participate in the ORM panel, and we > > >> have a web2py dojo @ 6PM / look on the Open Spaces board. > > > > You can also always ask Mary @ registration desk for help to find me (I > > > was > > > walking around w/ a walkie-talkie today, so should be reachable). > > > >>> On Mar 12, 12:29 am, Jorge Vargas wrote: > > >>> > On Thu, Mar 12, 2009 at 12:20 AM, Yarko Tymciurak > > >>> wrote: > > >>> > > We are working out details of what we'd like to propose to cover in > > >>> the > > >>> > > PyCon2009 web2py dojo, and it's looking pretty exciting. > > >>> > > We will have some more announcements around this. > > >>> > > Massimo will be starting us off, and Bruce Eckel will lead the dojo. > > >>> > > Stephen and John of Wingware are planning on joining in on the > > >>> > > dojo. > > >>> Maybe > > >>> > > you will too? > > > >>> > Hello guys, > > > >>> > I'm an outsider here, although I keep an eye on your list/product from > > >>> > time to time. > > > >>> > It will be great if you add yourself tohttp:// > > >>> us.pycon.org/2009/sprints/projects/ > > > >>> > You are also welcome to join ushttp:// > > >>> us.pycon.org/2009/sprints/projects/wsgi/ > > > >>> > > Hope to see you at PyCon2009! > > >>> > > Yarko > > > >>> > > On Mon, Mar 9, 2009 at 9:35 AM, Paul Eden > > >>> wrote: > > > >>> > >> I would have liked to be there at the Dojo, but unfortunately I am > > >>> flying > > >>> > >> back to Arizona Saturday night. > > > >>> > >> I'll definitely find the booth though. I can't wait to meet all of > > >>> you. > > > >>> > >> Paul > > > >>> > >> On Mon, Mar 9, 2009 at 7:28 AM, mdipierro > > >>> wrote: > > > >>> > >>> Thanks Paul, > > > >>> > >>> hope you can help with the booth too. We will also have a web2py > > >>> Dojo > > >>> > >>> on Saturday night. > > > >>> > >>> Massimo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18739] Need help with SQLFORMs
Here's the code: http://pastie.org/private/wmow1xkoaov5ium6cgf8w Here's the problem: ok now a new problem let's say im building a mailbox application (not like email like a private messaging system) and int he table mailbox I have account_id (which account its tied to) On the SQLFORM it shows Account ID: (which i changed to Player:) but I want the Player: field to actually be tied to accounts.name rather than mailbox.account_id and then use my own function called lookup_name() that returns the ID of the account's name would it be best practice to do theid = lookup_name (request.post.account_id) db.mailbox.account_id.default = theid ? Is there some kind of way to make it so SQLFORMS will do this automatically? I don't want that drop down box solution because when I have 100,000 user entries that would take a long time to load. :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18742] Re: Need help with SQLFORMs
I also would like to avoid running a query within the controller/ function of db(db.account.name==request.post.account_id) because I need this function in several places. :) On Mar 29, 3:19 pm, TheDude wrote: > Here's the code:http://pastie.org/private/wmow1xkoaov5ium6cgf8w > > Here's the problem: > ok now a new problem let's say im building a mailbox application (not > like email like a private messaging system) and int he table mailbox I > have account_id (which account its tied to) > On the SQLFORM it shows Account ID: (which i changed to > Player:) but I want the Player: field to actually be tied to > accounts.name rather than mailbox.account_id > and then use my own function called lookup_name() that returns the ID > of the account's name > would it be best practice to do theid = lookup_name > (request.post.account_id) db.mailbox.account_id.default = theid ? > > Is there some kind of way to make it so SQLFORMS will do this > automatically? I don't want that drop down box solution because when I > have 100,000 user entries that would take a long time to load. :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18750] Re: Need help with SQLFORMs
Worked like a charm thanks. :) Also taught me a few things heh ;) Btw, how was PyCon? On Mar 29, 5:25 pm, mdipierro wrote: > You can use > > class NameValidator: > def __init__(self,error_message='not in db'): > self.error_message=error_message > def __call__(self,name): > users=db(db.users.name==name).select() > if not users: return (name, self.error_message) > return (users[0].id,None) > def format(self,id) > return db.users[id].name > > db.mailbox.account_id.requires=NameValidator() > > In the page you may also need this: > > $(document).ready(function() { $('#mailbox_account_id').attr > ('class','string'); }); > > > Hope it makes sense. > > Massimo > > On Mar 29, 2:19 pm, TheDude wrote: > > > Here's the code:http://pastie.org/private/wmow1xkoaov5ium6cgf8w > > > Here's the problem: > > ok now a new problem let's say im building a mailbox application (not > > like email like a private messaging system) and int he table mailbox I > > have account_id (which account its tied to) > > On the SQLFORM it shows Account ID: (which i changed to > > Player:) but I want the Player: field to actually be tied to > > accounts.name rather than mailbox.account_id > > and then use my own function called lookup_name() that returns the ID > > of the account's name > > would it be best practice to do theid = lookup_name > > (request.post.account_id) db.mailbox.account_id.default = theid ? > > > Is there some kind of way to make it so SQLFORMS will do this > > automatically? I don't want that drop down box solution because when I > > have 100,000 user entries that would take a long time to load. :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18753] Re: Getting last item in a query?
Wouldn't last = db().select(db.table.ALL, orderby=~db.table.id, limit= (1,))[0] be better? Since this way only one row is being retrieved and less overhead? On Mar 29, 5:26 pm, mdipierro wrote: > last = db().select(db.table.ALL).as_list()[-1] > > On Mar 29, 3:42 pm, Michael wrote: > > > I wasn't sure if when you do > > > query = db().select(db.table.ALL) > > > returns as an array of items? > > > I am trying to get the last item added into the TABLE. I thought i > > could do: > > > query = db().select(db.table.ALL) > > last = query[-1] > > return dict(last=last) > > > but I am getting the following error: > > > Traceback (most recent call last): > > File "gluon/restricted.py", line 98, in restricted > > File "/Users/michaelnovia/Documents/web2py/web2py.app/Contents/ > > Resources/applications/philosaraptor/controllers/default.py", line 24, > > in > > File "gluon/globals.py", line 75, in > > File "/Users/michaelnovia/Documents/web2py/web2py.app/Contents/ > > Resources/applications/philosaraptor/controllers/default.py", line 9, > > in quote > > File "gluon/sql.py", line 2036, in __getitem__ > > SyntaxError: SQLRows: no such row --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18759] Re: Getting last item in a query?
last_id =db.table.insert(item="some item") this method is the best for you then (all cred to Vidul). Just change last_id to comment and then pass comment to the view and write down the variables that you need. :) Also, this is draginx from IRC, ask your questions there man I'll help you out again. ;) And thanks Massimo. :) On Mar 29, 7:45 pm, Michael wrote: > I don't get this? > > I am just trying to display the item added last to a table. > > For instance, i have a table of quotes. > > I would like to pass variables from that table, and the LAST record to > my view. > > such as, > > return dict(author=author, quote=quote) > > But author, and quote should be from the last record added. > > On Mar 29, 7:33 pm, Vidul Petrov wrote: > > > If you don't need a list, but just the last record, use the return > > value from insert: > > > last_id =db.table.insert(item="some item") > > > On Mar 30, 2:00 am, TheDude wrote: > > > > Wouldn't last = db().select(db.table.ALL, orderby=~db.table.id, limit= > > > (1,))[0] be better? Since this way only one row is being retrieved and > > > less overhead? > > > > On Mar 29, 5:26 pm, mdipierro wrote: > > > > > last = db().select(db.table.ALL).as_list()[-1] > > > > > On Mar 29, 3:42 pm, Michael wrote: > > > > > > I wasn't sure if when you do > > > > > > query = db().select(db.table.ALL) > > > > > > returns as an array of items? > > > > > > I am trying to get the last item added into the TABLE. I thought i > > > > > could do: > > > > > > query = db().select(db.table.ALL) > > > > > last = query[-1] > > > > > return dict(last=last) > > > > > > but I am getting the following error: > > > > > > Traceback (most recent call last): > > > > > File "gluon/restricted.py", line 98, in restricted > > > > > File "/Users/michaelnovia/Documents/web2py/web2py.app/Contents/ > > > > > Resources/applications/philosaraptor/controllers/default.py", line 24, > > > > > in > > > > > File "gluon/globals.py", line 75, in > > > > > File "/Users/michaelnovia/Documents/web2py/web2py.app/Contents/ > > > > > Resources/applications/philosaraptor/controllers/default.py", line 9, > > > > > in quote > > > > > File "gluon/sql.py", line 2036, in __getitem__ > > > > > SyntaxError: SQLRows: no such row --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18765] Re: Would this patch be useful?
This certainly breaks the MVC architecture, but it is valuable. I think web2py should be about being able to expand as much as possible without interfering the people who just want a small and easy framework (it can be a small plant or a big tree). I do like the idea of everything going into the same $().ready() function. After a bit of thinking about it, this would be no different (in terms of usability and mvc structure) as saying something like response.title = 'xxx' within the controller. I'm going to give this a thumbs up, as long as it doesn't slow down the framework and I wont be required to do it. ;) On Mar 30, 12:15 am, mdipierro wrote: > Some clarifications. > Right now one can already do this in views by inserting somewhere: > > > $(document).ready(function() { do_something(); }); > > > Mr. Freeze's suggestions has pros and cons. In my opinion: > > Pros: > - it is more compact > Cons: > - moves into the controller something that (usually) belongs to the > view. > - if the script in quotes has a bug it may break web2py_ajax > because everything would go in the same $(..).ready(function(){}). > > I would like to hear more opinions about this. Perhaps some examples > when this would be better than placing the code in the view. > > Massimo > > On Mar 29, 10:46 pm, Jason Brower wrote: > > > Good question. > > I like the idea as it gives us a nice place to put scripts and make them > > apply to the views we want very easily. so +1 on that! > > Regards, > > Jason Brower > > > On Sun, 2009-03-29 at 20:23 -0700, mr.freeze wrote: > > > It's basically a new global list, response.scripts, that is rendered > > > in the jQuery(document).ready function so you can inject javascript > > > from the controller. Massimo mentioned that it may go against MVC > > > separation standards and wanted me to put it out here to get a few > > > opinions. Sample usage: > > > > def index(): > > > if not request.vars.name: > > > response.scripts.append("$('#messages').text('Messages: Name > > > Missing').css('color','red');") > > > else: > > > response.scripts.append("$('#messages').text('Messages: Hello > > > " + request.vars.name + "');") > > > return dict() > > > > What do you think? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18768] Re: pycon 2009
Excellent! I wish there was a video, but I'm sure someone has it somewhere on the internet. Good work on the dojo, the only thing I was worried about is.. item = db.news_item[request.args[0]] If the request.args[0] tries to call from a non existant SQLRow then it'll throw an error :) Best to apply a try/except method here, but I guess for the purpose of the dojo it was OK (anyone trying to learn from the dojo on here should take notice of this however). On Mar 30, 1:39 am, Yarko Tymciurak wrote: > I personally want to thank Massimo for preparing the slides, and > Wingware.com for providing a 3-O/S WingIDE-Pro liscense (Jon B. was the > winner). > The code sprints for PyCon2009 run this week - I'm going to participate > after work (since I'm in the Chicago area)... there is a cherrypy sprint, > and an old bug I've never had the time to finish tracking down - I hope to > do that, and see if I can help the cherrypy folks w/ port to Python3. > > If you're in the area, be sure to stop by the Crown Plaza for whatever time > you can to the sprints. > > - Yarko > > On Sun, Mar 29, 2009 at 10:32 PM, mdipierro wrote: > > > Hi everybody, > > > this is a very short summary of what happened at PyCon concerning > > web2py. > > > I have a lightening talk on Saturday morning. 5 minutes only but I > > managed to give a demo. > > > There was this panel discussion > >http://www.b-list.org/weblog/2009/mar/28/pycon-orm-panel/ > > and I think web2py looked good considering that none of the other ORMs > > have any short term plan to support GAE. > > > We had a web2py dojo (http://en.wikipedia.org/wiki/Dojo) in the Open > > Space and we went over this exercise: > > >http://mdp.cti.depaul.edu/examples/static/dojo.pdf > > > We has a good attendance (13 people) and everybody completed the dojo. > > Nobody run away and we all went for a beer to the bar afterwords. We > > had very good time. > > > Yarko was there and contributed to develop the slides. Robin was also > > there. Other people where there but would not know how to match their > > real names to google usernames (if you attended the dojo, please email > > me to help me remember you). Barry Hawkins managed the Open Space and > > opened the dojo. > > > We distributed 102 web2py hats. They are all gone and, believe it not, > > many people were wearing them. > > > I spend most of my time talking to people and patching the > > registration software live so I did not have much time to attend > > talks. I am hoping to catch up by watching the recordings online. > > > I had to leave early today for personal reasons. > > > If you were there feel free to share your opinion with us. > > > Massimo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18798] Re: request for comments
Yes! I was disapointed to find out this wasn't the case and had to go back into my db.py models and change it. +1 :) On Mar 30, 11:11 am, AchipA wrote: > +1 > > On Mar 30, 4:37 pm, Kacper Krupa wrote: > > > i also agree > > > On Mar 30, 4:23 pm, Timothy Farrell wrote: > > > > +1 > > > > johann.scheibelho...@easytouch-edv.com wrote: > > > > agree > > > > > On Mar 30, 4:10 pm, mdipierro wrote: > > > > >> Right now if you say: > > > > >> db.table.field.writable=False > > > > >> your field will be hidden to both custom forms and appadmin forms. I > > > >> think appadmin forms should ignore these constraints and always > > > >> display all fields. Do you agree? > > > > >> Massimo > > > > -- > > > Timothy Farrell > > > Computer Guy > > > Statewide General Insurance Agency (www.swgen.com) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18864] Re: web2py dojo
Massimo, I tried the Dojo everything worked out fine. I didn't take screen shots, but if no one else is up for it I'll do it :P Only one question aboutit though. Why do you use db.Field() for declaring SQL Fields rather than SQLField() within the documentation? This may cause confusion for newbies. On Mar 30, 8:37 pm, mdipierro wrote: > Here is the source code we used for the web2py Dojo at PyCon. I have > no time to add screenshots but, if you decide to try this, could you > please send me some screenshots? Even better if you could make a > screencast about it. > > http://mdp.cti.depaul.edu/examples/static/dojo.pdf > > Massimo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18889] Re: Greeting and non-DAL usage question
As of right now, we're trying to get some screen shots for the Dojo as of right now and then Massimo will put them up on the website. I plan on doing the screen shots fairly soon, may be even tonight. :) On Mar 31, 11:30 pm, David Niergarth wrote: > Hello, > > I was at the PyCon dojo and got to meet several of you afterward. The > dojo project is a very good example for showing the breadth of web2py. > I heard a couple of people say "How come nobody knows about web2py > yet?" afterward. You may want to consider putting the dojo example on > the web2py documentation page and pointing new users to it. > > At work, we've been using web2py for the past month for a smaller ajax- > heavy project (translation: most of the time was spent dealing with > JavaScript & jQuery rather than web2py). The dojo PDF shows some good > examples of working with authentication and authorization, by the way. > > My question is getting long-ish so I'll ask it in a separate > message. ;) > > --David --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18891] Re: In cased you missed it
Pagination would be excellent and is a must, I may write a small function that does this exact thing. :) One thing I would like to see, is a nice tutorial on how to provide a search function within your website. Bonus points for using sphinx as the backend :) On Mar 31, 11:29 pm, Yarko Tymciurak wrote: > Not sure what you would want to port here; If I take this at face value, > here's what is currently documented (I've highlited what I thought might be > interesting from a web2py perspective). > In general, I think idea of having a package of light weight applications / > utilities is something both useful, and (at some level) something we're > doing w/ tools... auth, etc. > > - email confirmation > - This simple app is for cases where you don’t want to require an > email address to signup on your website but you do still want to > ask for an > email address and be able to confirm it for use in optional parts of > your > website > - timezones > - threaded comments > - with moderation > - ajax validation > - uses jquery > - flags > - This app lets users of your site flag content as inappropriate or > spam. > - pagination > - oembed > - notification > - mailer with a mail cue, this _might_ be interesting... > - dbtemplates > - robots > > On Tue, Mar 31, 2009 at 9:12 PM, mdipierro wrote: > > > Perhaps we should do it ourself for real. > > > On Mar 31, 7:11 pm, Yarko Tymciurak wrote: > > > Guys - this is a Joke (see also the "fued between pinax and > > > django") > > > see: http://www.ponyransom.com/ > > > > and: http://www.pinaxenvy.com/ > > > > On Tue, Mar 31, 2009 at 6:28 PM, mdipierro > > wrote: > > > > >http://twitter.com/jtauber/status/1420954914 > > > > > James. Are you here? > > > > > Massimo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18900] Re: In cased you missed it
Yarko, Does that injection still exist? And, we need a web2py 1.6 soon :P On Apr 1, 1:00 am, Vidul Petrov wrote: > Thank you, Massimo. > > One more question - a role can have many groups and vice versa, an > user can belong to many groups and vice versa? > > On Apr 1, 7:16 am, mdipierro wrote: > > > This is already in Auth. Auth actually does more than unix-like group > > based access control. It does Role based access control (group based > > is a particular case). > > > gid=auth.add_group(role='Manager') > > auth.add_membership(gid, auth.user.id) > > auth.add_permission(gid,'call function f') > > > @auth.requires_permission('call function f') > > def f(): return 1 > > > On Mar 31, 11:01 pm, Vidul Petrov wrote: > > > > IMHO such lightweight applications/utilities would make WEB2PY the > > > only so capable MVC player. > > > In addition I'd like to request comments on, let's call it feature - > > > now that Auth is in not an add-on, is there are a place for (optional) > > > UNIX-like users/resources management? > > > In short: each resource - every controler/action/etc. owned by a given > > > user/group, otherwise an user/group "nobody" or "guest". > > > > Does this make any sense? > > > > On Apr 1, 6:29 am, Yarko Tymciurak wrote: > > > > > Not sure what you would want to port here; If I take this at face > > > > value, > > > > here's what is currently documented (I've highlited what I thought > > > > might be > > > > interesting from a web2py perspective). > > > > In general, I think idea of having a package of light weight > > > > applications / > > > > utilities is something both useful, and (at some level) something we're > > > > doing w/ tools... auth, etc. > > > > > - email confirmation > > > > - This simple app is for cases where you don’t want to require an > > > > email address to signup on your website but you do still want to > > > > ask for an > > > > email address and be able to confirm it for use in optional parts > > > > of your > > > > website > > > > - timezones > > > > - threaded comments > > > > - with moderation > > > > - ajax validation > > > > - uses jquery > > > > - flags > > > > - This app lets users of your site flag content as inappropriate > > > > or > > > > spam. > > > > - pagination > > > > - oembed > > > > - notification > > > > - mailer with a mail cue, this _might_ be interesting... > > > > - dbtemplates > > > > - robots > > > > > On Tue, Mar 31, 2009 at 9:12 PM, mdipierro > > > > wrote: > > > > > > Perhaps we should do it ourself for real. > > > > > > On Mar 31, 7:11 pm, Yarko Tymciurak wrote: > > > > > > Guys - this is a Joke (see also the "fued between pinax and > > > > > > django") > > > > > > see: http://www.ponyransom.com/ > > > > > > > and: http://www.pinaxenvy.com/ > > > > > > > On Tue, Mar 31, 2009 at 6:28 PM, mdipierro > > > > > wrote: > > > > > > > >http://twitter.com/jtauber/status/1420954914 > > > > > > > > James. Are you here? > > > > > > > > Massimo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18921] Web2Py Conference
So who's going to it? It's in about 4 hours from now in Boston. I can't believe I drove all the way from South Georgia just for it! For some of those interested/near the area... We will be talking about: * How to develop nearly every single kind of application there is * How to clone Facebook in just as little as 2 hours with Web2Py * Why Django, Rails, etc. will eventually become completely obsolete with Web2Py as the victorious one. * Pylons will be merging with Web2Py, what does this mean for us? * Web2Py will be re-coded in C (but it will still work the same way). This is mostly for any speed/performance issues. * Web2Py will have a new T4 system that will allow you to develop GUI programs. This is very new and still in beta. * How to show off your Web2Py skills to your friends, families, and co- workers. You'll be guaranteed a hot date after showing a lovely girl Web2Py. So, who's going? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18925] Writing a Book
(This isn't an April Fool's Joke) So, I've been writing a book for Web2Py, but recently came towards a new direction...we already have a great in-depth book writeen by Massimo so I was wondering... Would you guys be interested in a book for web2py like 250 pages long that goes in-depth? Or, a nice little quick start guide :D here's the thing, BOTH will be able to teach you the fundamentals that you'll need to create 80%+ web applications. One will just tell you how to do things, but then link you to the documentation page available on web2py.com for more information. Examples: (QuickStart) In order to create a table for our database, we'll need to define our table. code: db.define_table('tablename', SQLField('fieldname','string', notnull=True) SQLField('fieldname2','integer', notnull=True), ) Let's say we wanted to have a table reference the "tablename" table. db.define_table('table2', SQLField('tablename_id', db.tablename), SQLField('imafield','boolean'), ) I think the quick-start guide will really help boost the web2py community and get people started on a project. It's similar to the Dojo, but a bit different since it'll go more in-depth than the Dojo but at the same time you don't have to learn everything. :) It will skip things like "What is MVC?" and "Why Web2Py framework" etc. I believe Massimo has already full-filled that information. The book will be available online (HTML) and PDF as well as a published book. Please let me know if your thoughts. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18926] Re: Web2Py Conference
ceej, DirectTV will be sponsoring the event, so it'll be featured on channel 328. As for cable users, the recordings will be placed online very shortly after. As for Yarko's mom, we will be featuring a segment of it in full HD on a 80 inch plasma screen TV. We really think this will help attract people to the show. As for t-shirts, hats, etc. none of that iwll be given out. However, we do have whips, chains, and boots with "Web2Py is sexy" written on them. On Apr 1, 2:27 pm, Timothy Farrell wrote: > Are you crazy? Have you never sat through Yarko's mom's home footage? > > Boring! > > :-D > > > > ceej wrote: > > Someone needs to take a video cam and record it :) > > > On Apr 1, 1:16 pm, TheDude wrote: > > >> So who's going to it? It's in about 4 hours from now in Boston. I > >> can't believe I drove all the way from South Georgia just for it! For > >> some of those interested/near the area... > > >> We will be talking about: > >> * How to develop nearly every single kind of application there is > >> * How to clone Facebook in just as little as 2 hours with Web2Py > >> * Why Django, Rails, etc. will eventually become completely obsolete > >> with Web2Py as the victorious one. > >> * Pylons will be merging with Web2Py, what does this mean for us? > >> * Web2Py will be re-coded in C (but it will still work the same way). > >> This is mostly for any speed/performance issues. > >> * Web2Py will have a new T4 system that will allow you to develop GUI > >> programs. This is very new and still in beta. > >> * How to show off your Web2Py skills to your friends, families, and co- > >> workers. You'll be guaranteed a hot date after showing a lovely girl > >> Web2Py. > > >> So, who's going? > > -- > Timothy Farrell > Computer Guy > Statewide General Insurance Agency (www.swgen.com) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18933] Re: Writing a Book
So the idea of writing a quick start jump guide is better than the in- depth version? OK then, I will get started shortly. :) It will take me quite some time to write this book, but I think it'll help the community tremendously. Massimo, if you have any insight on 1.6 (anything different coding wise from 1.59) please let me know. On Apr 1, 3:27 pm, g-man wrote: > Nice! > > One 'role model' you might want to study is Obie Fernandez' "The Rails > Way", which goes deeply into each element of that complex framework... > > On Apr 1, 11:28 am, TheDude wrote: > > > (This isn't an April Fool's Joke) > > > So, I've been writing a book for Web2Py, but recently came towards a > > new direction...we already have a great in-depth book writeen by > > Massimo so I was wondering... > > > Would you guys be interested in a book for web2py like 250 pages long > > that goes in-depth? Or, a nice little quick start guide :D here's the > > thing, BOTH will be able to teach you the fundamentals that you'll > > need to create 80%+ web applications. One will just tell you how to do > > things, but then link you to the documentation page available on > > web2py.com for more information. > > > Examples: > > (QuickStart) > > In order to create a table for our database, we'll need to define > b> our table. > > code: > > db.define_table('tablename', > > SQLField('fieldname','string', notnull=True) > > SQLField('fieldname2','integer', notnull=True), > > ) > > > Let's say we wanted to have a table reference the "tablename" table. > > db.define_table('table2', > > SQLField('tablename_id', db.tablename), > > SQLField('imafield','boolean'), > > ) > > > > the DAL explantion page for all options> > > > I think the quick-start guide will really help boost the web2py > > community and get people started on a project. It's similar to the > > Dojo, but a bit different since it'll go more in-depth than the Dojo > > but at the same time you don't have to learn everything. :) It will > > skip things like "What is MVC?" and "Why Web2Py framework" etc. I > > believe Massimo has already full-filled that information. > > > The book will be available online (HTML) and PDF as well as a > > published book. > > > Please let me know if your thoughts. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18955] auth and views?
I've tried using Web2Py's auth system and then tried creating the following views: user/register.html user/create.html default/user/register.html default/user/create.html auth/create.html auth/register.html None of them worked, how do you allow views for /default/user/ register ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18961] Re: auth and views?
#3 seems to be the best choice, thanks. Kind of seems weird, I thought def user(): would automatically link something like default/user/ login.html etc. But it's all good. :) Used to my own auth system (well ceej's :D) On Apr 1, 11:06 pm, Yarko Tymciurak wrote: > On Wed, Apr 1, 2009 at 9:56 PM, mdipierro wrote: > > > You have 3 options (assuming default.py controller) > > > 1) > > def user(): return auth() > > # create a single view called default/user.html for all urls > > > 2) > > def user(): > > if request.args: response.view='user/%s.html' % request.args[0] > > return auth() > > # create individual views 'default/user/login.html' etc. > > > 3) > > def login(): return auth.login() > > # create view "default/login.html" > > def register(): return auth.register() > > # create view "default/register.html" > > etc etc > > by the way, if you are going to do special stuff, your code will probably be > more explicit / readable w/ (3). > > > > > Massimo > > > On Apr 1, 9:26 pm, TheDude wrote: > > > I've tried using Web2Py's auth system and then tried creating the > > > following views: > > > user/register.html > > > user/create.html > > > default/user/register.html > > > default/user/create.html > > > auth/create.html > > > auth/register.html > > > > None of them worked, how do you allow views for /default/user/ > > > register ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18963] Re: auth and views?
3) def login(): return auth.login() # create view "default/login.html" def register(): return auth.register() # create view "default/register.html" etc etc I tried this method but no luck. It doesnt even show any kind of file (not even generic.html) It just shows the HTML of the form. Any ideas why? On Apr 1, 11:06 pm, Yarko Tymciurak wrote: > On Wed, Apr 1, 2009 at 9:56 PM, mdipierro wrote: > > > You have 3 options (assuming default.py controller) > > > 1) > > def user(): return auth() > > # create a single view called default/user.html for all urls > > > 2) > > def user(): > > if request.args: response.view='user/%s.html' % request.args[0] > > return auth() > > # create individual views 'default/user/login.html' etc. > > > 3) > > def login(): return auth.login() > > # create view "default/login.html" > > def register(): return auth.register() > > # create view "default/register.html" > > etc etc > > by the way, if you are going to do special stuff, your code will probably be > more explicit / readable w/ (3). > > > > > Massimo > > > On Apr 1, 9:26 pm, TheDude wrote: > > > I've tried using Web2Py's auth system and then tried creating the > > > following views: > > > user/register.html > > > user/create.html > > > default/user/register.html > > > default/user/create.html > > > auth/create.html > > > auth/register.html > > > > None of them worked, how do you allow views for /default/user/ > > > register ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18964] Re: auth and views?
Nevermind, I just did Yarko's method and that worked out fine. On Apr 1, 11:44 pm, TheDude wrote: > 3) > def login(): return auth.login() > # create view "default/login.html" > def register(): return auth.register() > # create view "default/register.html" > etc etc > I tried this method but no luck. It doesnt even show any kind of file > (not even generic.html) It just shows the HTML of the form. Any ideas > why? > > On Apr 1, 11:06 pm, Yarko Tymciurak wrote: > > > On Wed, Apr 1, 2009 at 9:56 PM, mdipierro wrote: > > > > You have 3 options (assuming default.py controller) > > > > 1) > > > def user(): return auth() > > > # create a single view called default/user.html for all urls > > > > 2) > > > def user(): > > > if request.args: response.view='user/%s.html' % request.args[0] > > > return auth() > > > # create individual views 'default/user/login.html' etc. > > > > 3) > > > def login(): return auth.login() > > > # create view "default/login.html" > > > def register(): return auth.register() > > > # create view "default/register.html" > > > etc etc > > > by the way, if you are going to do special stuff, your code will probably be > > more explicit / readable w/ (3). > > > > Massimo > > > > On Apr 1, 9:26 pm, TheDude wrote: > > > > I've tried using Web2Py's auth system and then tried creating the > > > > following views: > > > > user/register.html > > > > user/create.html > > > > default/user/register.html > > > > default/user/create.html > > > > auth/create.html > > > > auth/register.html > > > > > None of them worked, how do you allow views for /default/user/ > > > > register ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18965] DAL problem
def index(): rows = (db.mb_posts.board_id==db.mb_boards.id)& (db.mb_posts.reply_to==0) rows2 = (db.mb_posts.board_id==db.mb_boards.id) mb_posts2 = db.mb_posts.with_alias("mb_posts2") query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), db.mb_posts2.id.count(), left=(db.mb_posts.on(rows),db.mb_posts2.on (rows2)), groupby=db.mb_boards.id) return dict(query=query) gives me OperationalError: (1066, "Not unique table/alias: 'mb_posts'") However, should mb_posts2 show itself as LEFT JOIN mb_posts AS mb_posts2 ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18990] Re: DAL problem
Massimo, I still get the error: Traceback (most recent call last): File "/home/daniel/web2py/gluon/restricted.py", line 98, in restricted exec ccode in environment File "/home/daniel/web2py/applications/community/controllers/ forum.py", line 9, in File "/home/daniel/web2py/gluon/globals.py", line 75, in self._caller = lambda f: f() File "/home/daniel/web2py/applications/community/controllers/ forum.py", line 5, in index query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), db.mb_posts2.id.count(), left=(db.mb_posts.on(rows),db.mb_posts2.on (rows2)), groupby=db.mb_boards.id) File "/home/daniel/web2py/gluon/sql.py", line 1902, in select r = response(query) File "/home/daniel/web2py/gluon/sql.py", line 1897, in response self._db._execute(query) File "/home/daniel/web2py/gluon/sql.py", line 634, in **b) File "/var/lib/python-support/python2.5/MySQLdb/cursors.py", line 166, in execute self.errorhandler(self, exc, value) File "/var/lib/python-support/python2.5/MySQLdb/connections.py", line 35, in defaulterrorhandler raise errorclass, errorvalue OperationalError: (1066, "Not unique table/alias: 'mb_posts'") forum.py: def index(): rows = (db.mb_posts.board_id==db.mb_boards.id)& (db.mb_posts.reply_to==0) mb_posts2 = db.mb_posts.with_alias("mb_posts2") rows2 = (db.mb_posts2.board_id==db.mb_boards.id) query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), db.mb_posts2.id.count(), left=(db.mb_posts.on(rows),db.mb_posts2.on (rows2)), groupby=db.mb_boards.id) return dict(query=query) response._vars=response._caller(index) On Apr 2, 9:08 am, mdipierro wrote: > should be > > def index(): > rows = (db.mb_posts.board_id==db.mb_boards.id)& > (db.mb_posts.reply_to==0) > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > rows2 = (db.mb_posts2.board_id==db.mb_boards.id) > query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), > db.mb_posts2.id.count(), left=(db.mb_posts.on(rows),db.mb_posts2.on > (rows2)), groupby=db.mb_boards.id) > return dict(query=query) > > On Apr 1, 11:13 pm, TheDude wrote: > > > def index(): > > rows = (db.mb_posts.board_id==db.mb_boards.id)& > > (db.mb_posts.reply_to==0) > > rows2 = (db.mb_posts.board_id==db.mb_boards.id) > > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > > query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), > > db.mb_posts2.id.count(), left=(db.mb_posts.on(rows),db.mb_posts2.on > > (rows2)), groupby=db.mb_boards.id) > > return dict(query=query) > > > gives me > > OperationalError: (1066, "Not unique table/alias: 'mb_posts'") > > > However, should mb_posts2 show itself as LEFT JOIN mb_posts AS > > mb_posts2 ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18992] Re: DAL problem
SQL Works! However... {{=board.mb_boards.keys()}} brings up: ['update_record', 'mb_posts', 'description', 'id', 'name'] As you can see, no mb_posts2 (mb_posts does not contain mb_posts2 either). So, I said to myself may be it's because of the .ALL within the select. Still no go. On Apr 2, 2:56 pm, mdipierro wrote: > ry > > def index(): > rows = (db.mb_posts.board_id==db.mb_boards.id)& > (db.mb_posts.reply_to==0) > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > rows2 = (mb_posts2.board_id==db.mb_boards.id) > query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), > mb_posts2.id.count(), left=(db.mb_posts.on(rows),mb_posts2.on > (rows2)), groupby=db.mb_boards.id) > return dict(query=query) > > On Apr 2, 8:08 am, mdipierro wrote: > > > should be > > > def index(): > > rows = (db.mb_posts.board_id==db.mb_boards.id)& > > (db.mb_posts.reply_to==0) > > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > > rows2 = (db.mb_posts2.board_id==db.mb_boards.id) > > query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), > > db.mb_posts2.id.count(), left=(db.mb_posts.on(rows),db.mb_posts2.on > > (rows2)), groupby=db.mb_boards.id) > > return dict(query=query) > > > On Apr 1, 11:13 pm, TheDude wrote: > > > > def index(): > > > rows = (db.mb_posts.board_id==db.mb_boards.id)& > > > (db.mb_posts.reply_to==0) > > > rows2 = (db.mb_posts.board_id==db.mb_boards.id) > > > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > > > query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), > > > db.mb_posts2.id.count(), left=(db.mb_posts.on(rows),db.mb_posts2.on > > > (rows2)), groupby=db.mb_boards.id) > > > return dict(query=query) > > > > gives me > > > OperationalError: (1066, "Not unique table/alias: 'mb_posts'") > > > > However, should mb_posts2 show itself as LEFT JOIN mb_posts AS > > > mb_posts2 ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18996] Re: DAL problem
Sorry, it's in my views :) {{extend 'layout.html'}} Message Boards Board Threads Posts Last Topic {{for board in query:}} {{=A(board.mb_boards.name, _href=URL(r=request, f='view', args=board.mb_boards.id))}}{{=board.mb_boards.description}} {{=board.mb_boards.mb_posts.count()}} {{=board.mb_boards.keys()}} {{pass}} On Apr 2, 6:38 pm, mdipierro wrote: > what is "board"? > > On Apr 2, 5:20 pm, TheDude wrote: > > > SQL Works! However... > > > {{=board.mb_boards.keys()}} > > brings up: > > ['update_record', 'mb_posts', 'description', 'id', 'name'] > > > As you can see, no mb_posts2 (mb_posts does not contain mb_posts2 > > either). So, I said to myself may be it's because of the .ALL within > > the select. Still no go. > > > On Apr 2, 2:56 pm, mdipierro wrote: > > > > ry > > > > def index(): > > > rows = (db.mb_posts.board_id==db.mb_boards.id)& > > > (db.mb_posts.reply_to==0) > > > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > > > rows2 = (mb_posts2.board_id==db.mb_boards.id) > > > query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), > > > mb_posts2.id.count(), left=(db.mb_posts.on(rows),mb_posts2.on > > > (rows2)), groupby=db.mb_boards.id) > > > return dict(query=query) > > > > On Apr 2, 8:08 am, mdipierro wrote: > > > > > should be > > > > > def index(): > > > > rows = (db.mb_posts.board_id==db.mb_boards.id)& > > > > (db.mb_posts.reply_to==0) > > > > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > > > > rows2 = (db.mb_posts2.board_id==db.mb_boards.id) > > > > query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), > > > > db.mb_posts2.id.count(), left=(db.mb_posts.on(rows),db.mb_posts2.on > > > > (rows2)), groupby=db.mb_boards.id) > > > > return dict(query=query) > > > > > On Apr 1, 11:13 pm, TheDude wrote: > > > > > > def index(): > > > > > rows = (db.mb_posts.board_id==db.mb_boards.id)& > > > > > (db.mb_posts.reply_to==0) > > > > > rows2 = (db.mb_posts.board_id==db.mb_boards.id) > > > > > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > > > > > query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), > > > > > db.mb_posts2.id.count(), left=(db.mb_posts.on(rows),db.mb_posts2.on > > > > > (rows2)), groupby=db.mb_boards.id) > > > > > return dict(query=query) > > > > > > gives me > > > > > OperationalError: (1066, "Not unique table/alias: 'mb_posts'") > > > > > > However, should mb_posts2 show itself as LEFT JOIN mb_posts AS > > > > > mb_posts2 ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19008] Re: DAL problem
So, any suggestions? On Apr 2, 6:42 pm, TheDude wrote: > Sorry, it's in my views :) > > {{extend 'layout.html'}} > Message Boards > class="data"> > > Board > Threads > Posts > Last Topic > > {{for board in query:}} > > {{=A(board.mb_boards.name, _href=URL(r=request, f='view', > args=board.mb_boards.id))}}{{=board.mb_boards.description}} > {{=board.mb_boards.mb_posts.count()}} > {{=board.mb_boards.keys()}} > > > {{pass}} > > > On Apr 2, 6:38 pm, mdipierro wrote: > > > what is "board"? > > > On Apr 2, 5:20 pm, TheDude wrote: > > > > SQL Works! However... > > > > {{=board.mb_boards.keys()}} > > > brings up: > > > ['update_record', 'mb_posts', 'description', 'id', 'name'] > > > > As you can see, no mb_posts2 (mb_posts does not contain mb_posts2 > > > either). So, I said to myself may be it's because of the .ALL within > > > the select. Still no go. > > > > On Apr 2, 2:56 pm, mdipierro wrote: > > > > > ry > > > > > def index(): > > > > rows = (db.mb_posts.board_id==db.mb_boards.id)& > > > > (db.mb_posts.reply_to==0) > > > > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > > > > rows2 = (mb_posts2.board_id==db.mb_boards.id) > > > > query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), > > > > mb_posts2.id.count(), left=(db.mb_posts.on(rows),mb_posts2.on > > > > (rows2)), groupby=db.mb_boards.id) > > > > return dict(query=query) > > > > > On Apr 2, 8:08 am, mdipierro wrote: > > > > > > should be > > > > > > def index(): > > > > > rows = (db.mb_posts.board_id==db.mb_boards.id)& > > > > > (db.mb_posts.reply_to==0) > > > > > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > > > > > rows2 = (db.mb_posts2.board_id==db.mb_boards.id) > > > > > query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), > > > > > db.mb_posts2.id.count(), left=(db.mb_posts.on(rows),db.mb_posts2.on > > > > > (rows2)), groupby=db.mb_boards.id) > > > > > return dict(query=query) > > > > > > On Apr 1, 11:13 pm, TheDude wrote: > > > > > > > def index(): > > > > > > rows = (db.mb_posts.board_id==db.mb_boards.id)& > > > > > > (db.mb_posts.reply_to==0) > > > > > > rows2 = (db.mb_posts.board_id==db.mb_boards.id) > > > > > > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > > > > > > query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), > > > > > > db.mb_posts2.id.count(), left=(db.mb_posts.on(rows),db.mb_posts2.on > > > > > > (rows2)), groupby=db.mb_boards.id) > > > > > > return dict(query=query) > > > > > > > gives me > > > > > > OperationalError: (1066, "Not unique table/alias: 'mb_posts'") > > > > > > > However, should mb_posts2 show itself as LEFT JOIN mb_posts AS > > > > > > mb_posts2 ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19012] Re: Writing a Book
In response to cadrentes and to elaborate on the project more... The book will be made for people who don't have a lot of time on their hands and would like to get their hands "dirty" with Web2Py as fast as possible. Most of the book will contain links to resources and guides, including videos, recipes, plugins, and etc. It will help you migrate into the Web2Py community easily and understand all of the jargon used within Web2Py (which isn't a lot). The only thing I'd be worried about is what cadrentes said, he doesn't know much about programming but the web2py book assumes he does. The thing is, web2py book is about..well learning web2py not programming. There are many other excellent resources for learning python. In Massimo's book, it seems like he does teach a bare-bones-minimum python programming to get you by on what you need. So cadrentes, what were some of the things that you found troubling in the Web2Py Manual book? Overall, I think I'll be writing a lot of versions of the book online and keep improving on it, and then eventually publishing it once I feel the book has matured enough. Thanks for all of your help guys. :) On Apr 3, 9:53 am, cadrentes wrote: > I'm 38. I've been running Linux for a few years but I have no > programming experience ecxept; copy and past some VBA in Excel, a few > shell scripts, and a brief attempt at figuring out CakePHP. I've had > a copy of Massimo's book for about a month and it is great! I've > already put together a productivity application for my position at > work. But what really helps someone like me, who has about 20 minutes > a day to study these things, are working examples and the vimeo's he > put's out. I find that applying a solution helps my understanding of > the programming concept, which comes later. > > One thing I've noticed is that the programming community assumes I > know much more about programming concepts than I actually do. Having > examples with links to elaboration would be ideal. > > On Apr 1, 12:28 pm, TheDude wrote: > > > (This isn't an April Fool's Joke) > > > So, I've been writing a book for Web2Py, but recently came towards a > > new direction...we already have a great in-depth book writeen by > > Massimo so I was wondering... > > > Would you guys be interested in a book for web2py like 250 pages long > > that goes in-depth? Or, a nice little quick start guide :D here's the > > thing, BOTH will be able to teach you the fundamentals that you'll > > need to create 80%+ web applications. One will just tell you how to do > > things, but then link you to the documentation page available on > > web2py.com for more information. > > > Examples: > > (QuickStart) > > In order to create a table for our database, we'll need to define > b> our table. > > code: > > db.define_table('tablename', > > SQLField('fieldname','string', notnull=True) > > SQLField('fieldname2','integer', notnull=True), > > ) > > > Let's say we wanted to have a table reference the "tablename" table. > > db.define_table('table2', > > SQLField('tablename_id', db.tablename), > > SQLField('imafield','boolean'), > > ) > > > > the DAL explantion page for all options> > > > I think the quick-start guide will really help boost the web2py > > community and get people started on a project. It's similar to the > > Dojo, but a bit different since it'll go more in-depth than the Dojo > > but at the same time you don't have to learn everything. :) It will > > skip things like "What is MVC?" and "Why Web2Py framework" etc. I > > believe Massimo has already full-filled that information. > > > The book will be available online (HTML) and PDF as well as a > > published book. > > > Please let me know if your thoughts. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19020] Re: DAL problem
RIght tried those already... .keys() brings up ['update_record', 'mb_posts', 'description', 'id', 'name'] board._extra = no xml error I tried listing keys() and dir() mb_posts (see if it was somehow placed in there but it isn't). However, {{=query}} brings this... mb_boards.idmb_boards.name mb_boards.description COUNT(mb_posts.id) COUNT(mb_posts2.id) 1 Announcements All important...1 1 2 General Discu...General talk ...1 1 3 Suggestions/B...Report any bu...0 0 4 Off-Topic Not everythin...0 0 On Apr 3, 10:34 am, mdipierro wrote: > try: > {{=board.mb_boards.keys()}} > {{=board._extra}} > > On Apr 2, 5:20 pm, TheDude wrote: > > > SQL Works! However... > > > {{=board.mb_boards.keys()}} > > brings up: > > ['update_record', 'mb_posts', 'description', 'id', 'name'] > > > As you can see, no mb_posts2 (mb_posts does not contain mb_posts2 > > either). So, I said to myself may be it's because of the .ALL within > > the select. Still no go. > > > On Apr 2, 2:56 pm, mdipierro wrote: > > > > ry > > > > def index(): > > > rows = (db.mb_posts.board_id==db.mb_boards.id)& > > > (db.mb_posts.reply_to==0) > > > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > > > rows2 = (mb_posts2.board_id==db.mb_boards.id) > > > query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), > > > mb_posts2.id.count(), left=(db.mb_posts.on(rows),mb_posts2.on > > > (rows2)), groupby=db.mb_boards.id) > > > return dict(query=query) > > > > On Apr 2, 8:08 am, mdipierro wrote: > > > > > should be > > > > > def index(): > > > > rows = (db.mb_posts.board_id==db.mb_boards.id)& > > > > (db.mb_posts.reply_to==0) > > > > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > > > > rows2 = (db.mb_posts2.board_id==db.mb_boards.id) > > > > query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), > > > > db.mb_posts2.id.count(), left=(db.mb_posts.on(rows),db.mb_posts2.on > > > > (rows2)), groupby=db.mb_boards.id) > > > > return dict(query=query) > > > > > On Apr 1, 11:13 pm, TheDude wrote: > > > > > > def index(): > > > > > rows = (db.mb_posts.board_id==db.mb_boards.id)& > > > > > (db.mb_posts.reply_to==0) > > > > > rows2 = (db.mb_posts.board_id==db.mb_boards.id) > > > > > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > > > > > query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), > > > > > db.mb_posts2.id.count(), left=(db.mb_posts.on(rows),db.mb_posts2.on > > > > > (rows2)), groupby=db.mb_boards.id) > > > > > return dict(query=query) > > > > > > gives me > > > > > OperationalError: (1066, "Not unique table/alias: 'mb_posts'") > > > > > > However, should mb_posts2 show itself as LEFT JOIN mb_posts AS > > > > > mb_posts2 ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19024] Re: DAL problem
THat didn't work but.. {{=board._extra.keys()}} brings up ['COUNT(mb_posts.id)', 'COUNT (mb_posts2.id)'] So I did {{=board._extra['COUNT(mb_posts2.id)']}} and it works! Now, the only problem I have with this, is that it doesn't make to much logical sense to do things this way (it doesn't seem like a framework way more like a quick hack). Will there be any modifications within this area in 1.6? On Apr 3, 11:55 am, mdipierro wrote: > {{=board._extra[mb_posts2.id.count()]}} ? > > On Apr 3, 10:01 am, TheDude wrote: > > > RIght tried those already... > > .keys() brings up ['update_record', 'mb_posts', 'description', 'id', > > 'name'] > > board._extra = no xml error > > > I tried listing keys() and dir() mb_posts (see if it was somehow > > placed in there but it isn't). > > > However, {{=query}} brings this... > > mb_boards.id mb_boards.name mb_boards.description COUNT(mb_posts.id) > > COUNT(mb_posts2.id) > > 1 Announcements All important... 1 1 > > 2 General Discu... General talk ... 1 1 > > 3 Suggestions/B... Report any bu... 0 0 > > 4 Off-Topic Not everythin... 0 0 > > > On Apr 3, 10:34 am, mdipierro wrote: > > > > try: > > > {{=board.mb_boards.keys()}} > > > {{=board._extra}} > > > > On Apr 2, 5:20 pm, TheDude wrote: > > > > > SQL Works! However... > > > > > {{=board.mb_boards.keys()}} > > > > brings up: > > > > ['update_record', 'mb_posts', 'description', 'id', 'name'] > > > > > As you can see, no mb_posts2 (mb_posts does not contain mb_posts2 > > > > either). So, I said to myself may be it's because of the .ALL within > > > > the select. Still no go. > > > > > On Apr 2, 2:56 pm, mdipierro wrote: > > > > > > ry > > > > > > def index(): > > > > > rows = (db.mb_posts.board_id==db.mb_boards.id)& > > > > > (db.mb_posts.reply_to==0) > > > > > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > > > > > rows2 = (mb_posts2.board_id==db.mb_boards.id) > > > > > query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), > > > > > mb_posts2.id.count(), left=(db.mb_posts.on(rows),mb_posts2.on > > > > > (rows2)), groupby=db.mb_boards.id) > > > > > return dict(query=query) > > > > > > On Apr 2, 8:08 am, mdipierro wrote: > > > > > > > should be > > > > > > > def index(): > > > > > > rows = (db.mb_posts.board_id==db.mb_boards.id)& > > > > > > (db.mb_posts.reply_to==0) > > > > > > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > > > > > > rows2 = (db.mb_posts2.board_id==db.mb_boards.id) > > > > > > query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), > > > > > > db.mb_posts2.id.count(), left=(db.mb_posts.on(rows),db.mb_posts2.on > > > > > > (rows2)), groupby=db.mb_boards.id) > > > > > > return dict(query=query) > > > > > > > On Apr 1, 11:13 pm, TheDude wrote: > > > > > > > > def index(): > > > > > > > rows = (db.mb_posts.board_id==db.mb_boards.id)& > > > > > > > (db.mb_posts.reply_to==0) > > > > > > > rows2 = (db.mb_posts.board_id==db.mb_boards.id) > > > > > > > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > > > > > > > query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), > > > > > > > db.mb_posts2.id.count(), > > > > > > > left=(db.mb_posts.on(rows),db.mb_posts2.on > > > > > > > (rows2)), groupby=db.mb_boards.id) > > > > > > > return dict(query=query) > > > > > > > > gives me > > > > > > > OperationalError: (1066, "Not unique table/alias: 'mb_posts'") > > > > > > > > However, should mb_posts2 show itself as LEFT JOIN mb_posts AS > > > > > > > mb_posts2 ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19031] Re: DAL problem
Massimo, makes sense now that you've explained it a bit. Thanks. :) On Apr 3, 1:40 pm, mdipierro wrote: > There is a logic and these two > > {{=board._extra['COUNT(mb_posts2.id)']}} > {{=board._extra[mb_posts2.id.count()]}} > should be equivalent, in fact {{=mb_posts2.id.count()}} should be > 'COUNT(mb_posts2.id)'. > > The rationale is that rows=db(...).select > (table.field,table.field.aggregate()) > > table field goes in rows[i].table.field > while aggregates are not fields so they go in rows[i]._extra > [table.field.aggregate()] > > Massimo > > On Apr 3, 11:37 am, TheDude wrote: > > > THat didn't work but.. > > > {{=board._extra.keys()}} brings up ['COUNT(mb_posts.id)', 'COUNT > > (mb_posts2.id)'] > > > So I did {{=board._extra['COUNT(mb_posts2.id)']}} and it works! > > > Now, the only problem I have with this, is that it doesn't make to > > much logical sense to do things this way (it doesn't seem like a > > framework way more like a quick hack). Will there be any modifications > > within this area in 1.6? > > > On Apr 3, 11:55 am, mdipierro wrote: > > > > {{=board._extra[mb_posts2.id.count()]}} ? > > > > On Apr 3, 10:01 am, TheDude wrote: > > > > > RIght tried those already... > > > > .keys() brings up ['update_record', 'mb_posts', 'description', 'id', > > > > 'name'] > > > > board._extra = no xml error > > > > > I tried listing keys() and dir() mb_posts (see if it was somehow > > > > placed in there but it isn't). > > > > > However, {{=query}} brings this... > > > > mb_boards.id mb_boards.name mb_boards.description > > > > COUNT(mb_posts.id) > > > > COUNT(mb_posts2.id) > > > > 1 Announcements All important... 1 1 > > > > 2 General Discu... General talk ... 1 1 > > > > 3 Suggestions/B... Report any bu... 0 0 > > > > 4 Off-Topic Not everythin... 0 0 > > > > > On Apr 3, 10:34 am, mdipierro wrote: > > > > > > try: > > > > > {{=board.mb_boards.keys()}} > > > > > {{=board._extra}} > > > > > > On Apr 2, 5:20 pm, TheDude wrote: > > > > > > > SQL Works! However... > > > > > > > {{=board.mb_boards.keys()}} > > > > > > brings up: > > > > > > ['update_record', 'mb_posts', 'description', 'id', 'name'] > > > > > > > As you can see, no mb_posts2 (mb_posts does not contain mb_posts2 > > > > > > either). So, I said to myself may be it's because of the .ALL within > > > > > > the select. Still no go. > > > > > > > On Apr 2, 2:56 pm, mdipierro wrote: > > > > > > > > ry > > > > > > > > def index(): > > > > > > > rows = (db.mb_posts.board_id==db.mb_boards.id)& > > > > > > > (db.mb_posts.reply_to==0) > > > > > > > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > > > > > > > rows2 = (mb_posts2.board_id==db.mb_boards.id) > > > > > > > query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(), > > > > > > > mb_posts2.id.count(), left=(db.mb_posts.on(rows),mb_posts2.on > > > > > > > (rows2)), groupby=db.mb_boards.id) > > > > > > > return dict(query=query) > > > > > > > > On Apr 2, 8:08 am, mdipierro wrote: > > > > > > > > > should be > > > > > > > > > def index(): > > > > > > > > rows = (db.mb_posts.board_id==db.mb_boards.id)& > > > > > > > > (db.mb_posts.reply_to==0) > > > > > > > > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > > > > > > > > rows2 = (db.mb_posts2.board_id==db.mb_boards.id) > > > > > > > > query = db().select(db.mb_boards.ALL, > > > > > > > > db.mb_posts.id.count(), > > > > > > > > db.mb_posts2.id.count(), > > > > > > > > left=(db.mb_posts.on(rows),db.mb_posts2.on > > > > > > > > (rows2)), groupby=db.mb_boards.id) > > > > > > > > return dict(query=query) > > > > > > > > > On Apr 1, 11:13 pm, TheDude wrote: > > > > > > > > > > def index(): > > > > > > > > > rows = (db.mb_posts.board_id==db.mb_boards.id)& > > > > > > > > > (db.mb_posts.reply_to==0) > > > > > > > > > rows2 = (db.mb_posts.board_id==db.mb_boards.id) > > > > > > > > > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > > > > > > > > > query = db().select(db.mb_boards.ALL, > > > > > > > > > db.mb_posts.id.count(), > > > > > > > > > db.mb_posts2.id.count(), > > > > > > > > > left=(db.mb_posts.on(rows),db.mb_posts2.on > > > > > > > > > (rows2)), groupby=db.mb_boards.id) > > > > > > > > > return dict(query=query) > > > > > > > > > > gives me > > > > > > > > > OperationalError: (1066, "Not unique table/alias: 'mb_posts'") > > > > > > > > > > However, should mb_posts2 show itself as LEFT JOIN mb_posts AS > > > > > > > > > mb_posts2 ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19087] Sub query not registering accurately?
Tried using this as logging tool: http://mdp.cti.depaul.edu/AlterEgo/default/show/194 But it didn't record where I have the problem at all (even after my patches). The controller: def view(): #try: board = db(db.mb_boards.id==request.args[0]).select()[0] rows = (db.auth_user.id==db.mb_posts.posted_by) mb_posts2 = db.mb_posts.with_alias("mb_posts2") rows2 = (mb_posts2.reply_to==db.mb_posts.id) mb_posts3 = db.mb_posts.with_alias("mb_posts3") threads = db((db.mb_posts.board_id==request.args[0])& (db.mb_posts.reply_to==None)).select(db.mb_posts.ALL, db.auth_user.ALL,mb_posts2.id.count(), db (mb_posts3.reply_to==db.mb_posts.id)._select(mb_posts3.id, orderby=~mb_posts3.id, limitby=(0,1)), left=(db.auth_user.on (rows),mb_posts2.on(rows2)), groupby=db.mb_posts.id) return dict(board=board, threads=threads) #except: #session.flash = "This board doesn't exist." # redirect(URL(r=request, f='index')) The problem: ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT mb_posts3.id FROM mb_posts3, mb_posts WHERE mb_posts3.reply_to=mb_posts.i' at line 1") What I'm trying to do: mb_posts2 = The # of replies within that topic/thread (this works) mb_posts3 = The last reply created within that topic (sub query will do fine). I've tried various ways, the aggregate way, another left join, nothing seems to work. Asked a few people on the IRC as well, but they were just as lost as me. Anyone on here have any thoughts on the situation? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19093] Re: reponse.flash and auth.messages problem
Vidul. Take a look at this page: http://mdp.cti.depaul.edu/examples/default/tools Under "Custom Authentication" On Apr 4, 12:06 pm, Vidul Petrov wrote: > The problem is that the following two lines work fine (are copied in > response.flash), > > auth.messages.logged_out = 'You have been logged out successfully' > auth.messages.logged_in = 'You have been logged in successfully' > > but these do not appear anywhere (while trying "user/profile" and > "user/profile"): > > auth.messages.profile_updated = 'Your profile have been udated > successfully' > auth.messages.password_changed = 'Your password has been changed > successfully' > > Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19121] Re: Sub query not registering accurately?
Would really like a response to this. =/ On Apr 4, 11:58 am, TheDude wrote: > Tried using this as logging > tool:http://mdp.cti.depaul.edu/AlterEgo/default/show/194 > > But it didn't record where I have the problem at all (even after my > patches). > > The controller: > def view(): > #try: > board = db(db.mb_boards.id==request.args[0]).select()[0] > rows = (db.auth_user.id==db.mb_posts.posted_by) > mb_posts2 = db.mb_posts.with_alias("mb_posts2") > rows2 = (mb_posts2.reply_to==db.mb_posts.id) > mb_posts3 = db.mb_posts.with_alias("mb_posts3") > threads = db((db.mb_posts.board_id==request.args[0])& > (db.mb_posts.reply_to==None)).select(db.mb_posts.ALL, > db.auth_user.ALL,mb_posts2.id.count(), db > (mb_posts3.reply_to==db.mb_posts.id)._select(mb_posts3.id, > orderby=~mb_posts3.id, limitby=(0,1)), left=(db.auth_user.on > (rows),mb_posts2.on(rows2)), groupby=db.mb_posts.id) > return dict(board=board, threads=threads) > #except: > # session.flash = "This board doesn't exist." > # redirect(URL(r=request, f='index')) > > The problem: > ProgrammingError: (1064, "You have an error in your SQL syntax; check > the manual that corresponds to your MySQL server version for the right > syntax to use near 'SELECT mb_posts3.id FROM mb_posts3, mb_posts WHERE > mb_posts3.reply_to=mb_posts.i' at line 1") > > What I'm trying to do: > mb_posts2 = The # of replies within that topic/thread (this works) > mb_posts3 = The last reply created within that topic (sub query will > do fine). > > I've tried various ways, the aggregate way, another left join, nothing > seems to work. Asked a few people on the IRC as well, but they were > just as lost as me. Anyone on here have any thoughts on the situation? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19124] Re: Sub query not registering accurately?
Steve, can you explain this more please? And the ~ means "DESC" :) On Apr 5, 12:33 am, Steve Shepherd wrote: > Whats the ~ tilde doing in your code? > The other way to do this is return the rows you want and use an object count > and then use a command to return the last object from the list. > Rather than do all that sql which is slow put it into the var and use code > on the var > > Steve --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19158] Re: Sub query not registering accurately?
Thanks guys :) It's been really bogging down my productivity within the website, but here is the query that I am trying to perform.. SELECT mb_posts.id, mb_posts.title, mb_posts.message, mb_posts.posted_by, mb_posts.date_posted, mb_posts.locked, mb_posts.sticky, mb_posts.last_edited, mb_posts.board_id, mb_posts.reply_to, mb_posts.views, auth_user.id, auth_user.first_name, auth_user.last_name, auth_user.email, auth_user.password, auth_user.registration_key, COUNT(mb_posts2.id), (SELECT mb_posts.id FROM mb_posts AS mb_posts3 WHERE mb_posts3.reply_to=mb_posts.id ORDER BY mb_posts3.id DESC LIMIT 1) FROM mb_posts LEFT JOIN auth_user ON auth_user.id=mb_posts.posted_by LEFT JOIN mb_posts AS mb_posts2 ON mb_posts2.reply_to=mb_posts.id WHERE (mb_posts.board_id=1 AND mb_posts.reply_to IS NULL) GROUP BY mb_posts.id Hope that makes a bit more sense. :) Everything in the qery works fine except for mb_posts3 info. I'm trying to select the latest reply created to that thread. On Apr 5, 11:26 am, Michal Jursa wrote: > I already tried that removement of the semicolon directly in the query > and that still doesn't work. To say true i cannot get the sense of the > query so i cannot clearly debug it coz i never used subselects in field > list. > > Michal alias Plysak > > mdipierro wrote: > > I see the problem. > > > The structure of that query is > > > db().select(...,db(...)._select(...),...) # wrong > > > The DAL is not designed to do this because it is not a good idea (as > > Michal points out). You may be able to do it anyway > > > db().select(...,db(...)._select(...)[:-1],...) # wrong? > > > But it may still not work. nested selects should go in the query, not > > in the list of fields to be selected. You may need to refactor your > > select. Perhaps if you explain in words what you are trying to select > > we can help more. > > > Massimo > > > On Apr 5, 9:27 am, Michal Jursa wrote: > >> I'm getting interested in this, coz that query is strange, but what that > >> DAL call generates is: > > >> SELECT mb_posts.id, mb_posts.title, mb_posts.message, > >> mb_posts.posted_by, mb_posts.date_posted, mb_posts.locked, > >> mb_posts.sticky, mb_posts.last_edited, mb_posts.board_id, > >> mb_posts.reply_to, mb_posts.views, auth_user.id, auth_user.first_name, > >> auth_user.last_name, auth_user.email, auth_user.password, > >> auth_user.registration_key, COUNT(mb_posts2.id), SELECT mb_posts3.id > >> FROM mb_posts3, mb_posts WHERE mb_posts3.reply_to=mb_posts.id ORDER BY > >> mb_posts3.id DESC LIMIT 1 OFFSET 0; FROM mb_posts, mb_posts3 LEFT JOIN > >> auth_user ON auth_user.id=mb_posts.posted_by LEFT JOIN mb_posts AS > >> mb_posts2 ON mb_posts2.reply_to=mb_posts.id WHERE (mb_posts.board_id=1 > >> AND mb_posts.reply_to IS NULL) GROUP BY mb_posts.id > > >> So the first thing is there is a ';' sighn after OFFSET statement in the > >> middle of query and the second thing is that this is not the way > >> subselects are supposed to be used. Try to examine it further, i'm > >> getting a bit lost in it. I think it is terribly complicated for the > >> functionality it should provide. > > >> Plysak --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19163] Re: Sub query not registering accurately?
Massimo, That's the query that I'm TRYING to perform. Web2Py is NOT doing that. Here's my models: http://pastie.org/private/kgrvhedmnq1mm9jivc1h3w I'm trying to link up (mb_posts3) into the query by selecting the last entry of "mb_posts3" (mb_posts3 = mb_posts with_alias) matching the WHERE criteria (mb_posts3.reply_to==mb_posts.id). I'm honestly just trying to do a sub-query within the query. Here's the view: http://pastie.org/private/9sycnfi3b4xz4ij5m1d7na On Apr 5, 12:10 pm, Michal Jursa wrote: > Repost from IRC conversation: > > 16:27:47 basically im getting a list of topics with a specific > board_id > 16:28:06 within the same query, I'm trying to retrieve the > latest reply to each topic > > Michal alias Plysak > > mdipierro wrote: > > It is very hard for me (and everybody) to debug this without having a > > copy of the model and without understanding what this is supposed to > > do. Could you explain what you are trying to do? > > > Is the querly below in SQL the one that "you are trying to perform" or > > the one that you are actually performing and does not work? > > Is it the output of db(...)._select()? > > > Massimo > > > On Apr 5, 10:47 am, TheDude wrote: > >> Thanks guys :) It's been really bogging down my productivity within > >> the website, but here is the query that I am trying to perform.. > > >> SELECT mb_posts.id, mb_posts.title, mb_posts.message, > >> mb_posts.posted_by, mb_posts.date_posted, mb_posts.locked, > >> mb_posts.sticky, mb_posts.last_edited, mb_posts.board_id, > >> mb_posts.reply_to, mb_posts.views, auth_user.id, auth_user.first_name, > >> auth_user.last_name, auth_user.email, auth_user.password, > >> auth_user.registration_key, COUNT(mb_posts2.id), (SELECT mb_posts.id > >> FROM mb_posts AS mb_posts3 WHERE mb_posts3.reply_to=mb_posts.id ORDER > >> BY > >> mb_posts3.id DESC LIMIT 1) FROM mb_posts LEFT JOIN > >> auth_user ON auth_user.id=mb_posts.posted_by LEFT JOIN mb_posts AS > >> mb_posts2 ON mb_posts2.reply_to=mb_posts.id WHERE (mb_posts.board_id=1 > >> AND mb_posts.reply_to IS NULL) GROUP BY mb_posts.id > > >> Hope that makes a bit more sense. :) Everything in the qery works fine > >> except for mb_posts3 info. I'm trying to select the latest reply > >> created to that thread. > > >> On Apr 5, 11:26 am, Michal Jursa wrote: > > >>> I already tried that removement of the semicolon directly in the query > >>> and that still doesn't work. To say true i cannot get the sense of the > >>> query so i cannot clearly debug it coz i never used subselects in field > >>> list. > >>> Michal alias Plysak > >>> mdipierro wrote: > >>>> I see the problem. > >>>> The structure of that query is > >>>> db().select(...,db(...)._select(...),...) # wrong > >>>> The DAL is not designed to do this because it is not a good idea (as > >>>> Michal points out). You may be able to do it anyway > >>>> db().select(...,db(...)._select(...)[:-1],...) # wrong? > >>>> But it may still not work. nested selects should go in the query, not > >>>> in the list of fields to be selected. You may need to refactor your > >>>> select. Perhaps if you explain in words what you are trying to select > >>>> we can help more. > >>>> Massimo > >>>> On Apr 5, 9:27 am, Michal Jursa wrote: > >>>>> I'm getting interested in this, coz that query is strange, but what that > >>>>> DAL call generates is: > >>>>> SELECT mb_posts.id, mb_posts.title, mb_posts.message, > >>>>> mb_posts.posted_by, mb_posts.date_posted, mb_posts.locked, > >>>>> mb_posts.sticky, mb_posts.last_edited, mb_posts.board_id, > >>>>> mb_posts.reply_to, mb_posts.views, auth_user.id, auth_user.first_name, > >>>>> auth_user.last_name, auth_user.email, auth_user.password, > >>>>> auth_user.registration_key, COUNT(mb_posts2.id), SELECT mb_posts3.id > >>>>> FROM mb_posts3, mb_posts WHERE mb_posts3.reply_to=mb_posts.id ORDER BY > >>>>> mb_posts3.id DESC LIMIT 1 OFFSET 0; FROM mb_posts, mb_posts3 LEFT JOIN > >>>>> auth_user ON auth_user.id=mb_posts.posted_by LEFT JOIN mb_posts AS > >>>>> mb_posts2 ON mb_posts2.reply_to=mb_posts.id WHERE (mb_posts.board_id=1 > >>>>> AND mb_posts.reply_to IS NULL) GROUP BY mb_posts.id > >>>>> So the first thing is there is a ';' sighn after OFFSET statement in the > >>>>> middle of query and the second thing is that this is not the way > >>>>> subselects are supposed to be used. Try to examine it further, i'm > >>>>> getting a bit lost in it. I think it is terribly complicated for the > >>>>> functionality it should provide. > >>>>> Plysak --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19164] Re: Sub query not registering accurately?
Don't know if the google groups posted this already but lets try again.. Models: http://pastie.org/private/kgrvhedmnq1mm9jivc1h3w Controller: http://pastie.org/private/9sycnfi3b4xz4ij5m1d7na Problem: Trying to select the last mb_posts3.reply_to==mb_posts.id..JUST the last one. Massimo, That SQL I posted was from me, not generated by Web2Py. On Apr 5, 12:10 pm, Michal Jursa wrote: > Repost from IRC conversation: > > 16:27:47 basically im getting a list of topics with a specific > board_id > 16:28:06 within the same query, I'm trying to retrieve the > latest reply to each topic > > Michal alias Plysak > > mdipierro wrote: > > It is very hard for me (and everybody) to debug this without having a > > copy of the model and without understanding what this is supposed to > > do. Could you explain what you are trying to do? > > > Is the querly below in SQL the one that "you are trying to perform" or > > the one that you are actually performing and does not work? > > Is it the output of db(...)._select()? > > > Massimo > > > On Apr 5, 10:47 am, TheDude wrote: > >> Thanks guys :) It's been really bogging down my productivity within > >> the website, but here is the query that I am trying to perform.. > > >> SELECT mb_posts.id, mb_posts.title, mb_posts.message, > >> mb_posts.posted_by, mb_posts.date_posted, mb_posts.locked, > >> mb_posts.sticky, mb_posts.last_edited, mb_posts.board_id, > >> mb_posts.reply_to, mb_posts.views, auth_user.id, auth_user.first_name, > >> auth_user.last_name, auth_user.email, auth_user.password, > >> auth_user.registration_key, COUNT(mb_posts2.id), (SELECT mb_posts.id > >> FROM mb_posts AS mb_posts3 WHERE mb_posts3.reply_to=mb_posts.id ORDER > >> BY > >> mb_posts3.id DESC LIMIT 1) FROM mb_posts LEFT JOIN > >> auth_user ON auth_user.id=mb_posts.posted_by LEFT JOIN mb_posts AS > >> mb_posts2 ON mb_posts2.reply_to=mb_posts.id WHERE (mb_posts.board_id=1 > >> AND mb_posts.reply_to IS NULL) GROUP BY mb_posts.id > > >> Hope that makes a bit more sense. :) Everything in the qery works fine > >> except for mb_posts3 info. I'm trying to select the latest reply > >> created to that thread. > > >> On Apr 5, 11:26 am, Michal Jursa wrote: > > >>> I already tried that removement of the semicolon directly in the query > >>> and that still doesn't work. To say true i cannot get the sense of the > >>> query so i cannot clearly debug it coz i never used subselects in field > >>> list. > >>> Michal alias Plysak > >>> mdipierro wrote: > >>>> I see the problem. > >>>> The structure of that query is > >>>> db().select(...,db(...)._select(...),...) # wrong > >>>> The DAL is not designed to do this because it is not a good idea (as > >>>> Michal points out). You may be able to do it anyway > >>>> db().select(...,db(...)._select(...)[:-1],...) # wrong? > >>>> But it may still not work. nested selects should go in the query, not > >>>> in the list of fields to be selected. You may need to refactor your > >>>> select. Perhaps if you explain in words what you are trying to select > >>>> we can help more. > >>>> Massimo > >>>> On Apr 5, 9:27 am, Michal Jursa wrote: > >>>>> I'm getting interested in this, coz that query is strange, but what that > >>>>> DAL call generates is: > >>>>> SELECT mb_posts.id, mb_posts.title, mb_posts.message, > >>>>> mb_posts.posted_by, mb_posts.date_posted, mb_posts.locked, > >>>>> mb_posts.sticky, mb_posts.last_edited, mb_posts.board_id, > >>>>> mb_posts.reply_to, mb_posts.views, auth_user.id, auth_user.first_name, > >>>>> auth_user.last_name, auth_user.email, auth_user.password, > >>>>> auth_user.registration_key, COUNT(mb_posts2.id), SELECT mb_posts3.id > >>>>> FROM mb_posts3, mb_posts WHERE mb_posts3.reply_to=mb_posts.id ORDER BY > >>>>> mb_posts3.id DESC LIMIT 1 OFFSET 0; FROM mb_posts, mb_posts3 LEFT JOIN > >>>>> auth_user ON auth_user.id=mb_posts.posted_by LEFT JOIN mb_posts AS > >>>>> mb_posts2 ON mb_posts2.reply_to=mb_posts.id WHERE (mb_posts.board_id=1 > >>>>> AND mb_posts.reply_to IS NULL) GROUP BY mb_posts.id > >>>>> So the first thing is there is a ';' sighn after OFFSET statement in the > >>>>> middle of query and the second thing is that this is not the way > >>>>> subselects are supposed to be used. Try to examine it further, i'm > >>>>> getting a bit lost in it. I think it is terribly complicated for the > >>>>> functionality it should provide. > >>>>> Plysak --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19436] Table already exists, yes I know so SKIP it.
OperationalError: (1050, "Table 'users' already exists") I know it already exists, but I want you to just know about it rather than try to create it all the time. I tried clearing out my /databases folder as well. Any other ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19537] Re: Sub query not registering accurately?
Any luck on the matter? THis is the query that I am trying to perform: SELECT mb_posts.id, mb_posts.title, mb_posts.message, mb_posts.posted_by, mb_posts.date_posted, mb_posts.locked, mb_posts.sticky, mb_posts.last_edited, mb_posts.board_id, mb_posts.reply_to, mb_posts.views, auth_user.id, auth_user.first_name, auth_user.last_name, auth_user.email, auth_user.password, auth_user.registration_key, (SELECT mb_posts3.id, mb_posts3.title FROM mb_posts3 WHERE mb_posts3.reply_to=mb_posts.id ORDER BY mb_posts3.id DESC LIMIT 1), COUNT(mb_posts2.id) FROM mb_posts LEFT JOIN auth_user ON auth_user.id=mb_posts.posted_by LEFT JOIN mb_posts AS mb_posts2 ON mb_posts2.reply_to=mb_posts.id WHERE (mb_posts.board_id=1 AND mb_posts.reply_to IS NULL) GROUP BY mb_posts.id; On Apr 5, 12:43 pm, TheDude wrote: > Don't know if the google groups posted this already but lets try > again.. > Models:http://pastie.org/private/kgrvhedmnq1mm9jivc1h3w > > Controller:http://pastie.org/private/9sycnfi3b4xz4ij5m1d7na > > Problem: > Trying to select the last mb_posts3.reply_to==mb_posts.id..JUST the > last one. > > Massimo, > That SQL I posted was from me, not generated by Web2Py. > > On Apr 5, 12:10 pm, Michal Jursa wrote: > > > Repost from IRC conversation: > > > 16:27:47 basically im getting a list of topics with a specific > > board_id > > 16:28:06 within the same query, I'm trying to retrieve the > > latest reply to each topic > > > Michal alias Plysak > > > mdipierro wrote: > > > It is very hard for me (and everybody) to debug this without having a > > > copy of the model and without understanding what this is supposed to > > > do. Could you explain what you are trying to do? > > > > Is the querly below in SQL the one that "you are trying to perform" or > > > the one that you are actually performing and does not work? > > > Is it the output of db(...)._select()? > > > > Massimo > > > > On Apr 5, 10:47 am, TheDude wrote: > > >> Thanks guys :) It's been really bogging down my productivity within > > >> the website, but here is the query that I am trying to perform.. > > > >> SELECT mb_posts.id, mb_posts.title, mb_posts.message, > > >> mb_posts.posted_by, mb_posts.date_posted, mb_posts.locked, > > >> mb_posts.sticky, mb_posts.last_edited, mb_posts.board_id, > > >> mb_posts.reply_to, mb_posts.views, auth_user.id, auth_user.first_name, > > >> auth_user.last_name, auth_user.email, auth_user.password, > > >> auth_user.registration_key, COUNT(mb_posts2.id), (SELECT mb_posts.id > > >> FROM mb_posts AS mb_posts3 WHERE mb_posts3.reply_to=mb_posts.id ORDER > > >> BY > > >> mb_posts3.id DESC LIMIT 1) FROM mb_posts LEFT JOIN > > >> auth_user ON auth_user.id=mb_posts.posted_by LEFT JOIN mb_posts AS > > >> mb_posts2 ON mb_posts2.reply_to=mb_posts.id WHERE (mb_posts.board_id=1 > > >> AND mb_posts.reply_to IS NULL) GROUP BY mb_posts.id > > > >> Hope that makes a bit more sense. :) Everything in the qery works fine > > >> except for mb_posts3 info. I'm trying to select the latest reply > > >> created to that thread. > > > >> On Apr 5, 11:26 am, Michal Jursa wrote: > > > >>> I already tried that removement of the semicolon directly in the query > > >>> and that still doesn't work. To say true i cannot get the sense of the > > >>> query so i cannot clearly debug it coz i never used subselects in field > > >>> list. > > >>> Michal alias Plysak > > >>> mdipierro wrote: > > >>>> I see the problem. > > >>>> The structure of that query is > > >>>> db().select(...,db(...)._select(...),...) # wrong > > >>>> The DAL is not designed to do this because it is not a good idea (as > > >>>> Michal points out). You may be able to do it anyway > > >>>> db().select(...,db(...)._select(...)[:-1],...) # wrong? > > >>>> But it may still not work. nested selects should go in the query, not > > >>>> in the list of fields to be selected. You may need to refactor your > > >>>> select. Perhaps if you explain in words what you are trying to select > > >>>> we can help more. > > >>>> Massimo > > >>>> On Apr 5, 9:27 am, Michal Jursa wrote: > > >>>>> I'm getting interested in this, coz that query is strange, but what > > >>>>> that > > >>>>> DAL call generates
[web2py:19581] Idea
Allow sub-queries to be performed within the DAL. How? This would be a good example. db(db.table.field1==db.tbl2.field2).select(db.tbl2.ALL, db (db.hola.id==db.massimo.the_id)._select(db.hola.ALL)) The db() within a .select() should perform a subquery when selecting like that. The system currently does the correct SQL code *EXCEPT* adding parenthesis around the actual query. The only problem with this, is that I don't know if it's SQL standard. I believe it is, but can someone back this up? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19596] Migration Issues
OK, so I had a migration issue with my DB some time ago, the easy fix was migrate=False on all of my tables. I knew this was a bad fix, because it was a short-term solution. I get the error "Table feed already exists" now this is true, so instead of trying to create the table, skip the procedure of creating it? I cleared out my databases folder I added migrate=False to all of my folders then I added a field through mysql onto my table "feed". I wanted the field ("to_player") to be recognized by web2py. I get this error when I try to db.feed.to_player OperationalError: (1054, "Unknown column 'feed.to_player' in 'on clause'") mysql> show fields from feed; +--+--+--+-+-++ | Field| Type | Null | Key | Default | Extra | +--+--+--+-+-++ | id | int(11) | NO | PRI | NULL| auto_increment | | account_id | int(11) | YES | MUL | NULL|| | to_player| int(11) | NO | | NULL|| | date_created | datetime | YES | | NULL|| | message | longtext | YES | | NULL|| +--+--+--+-+-++ 5 rows in set (0.00 sec) Does this make sense in the way on how web2py is structured? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19598] Re: Migration Issues
Yup here it is: http://paste.pocoo.org/show/guKnBZMTv6AIOHzjz6zd/ On Apr 11, 3:30 pm, mdipierro wrote: > can you show us the web2py model and the query? > > On Apr 11, 2:23 pm, TheDude wrote: > > > OK, so I had a migration issue with my DB some time ago, the easy fix > > was migrate=False on all of my tables. I knew this was a bad fix, > > because it was a short-term solution. I get the error "Table feed > > already exists" now this is true, so instead of trying to create the > > table, skip the procedure of creating it? > > > I cleared out my databases folder > > I added migrate=False to all of my folders > > then I added a field through mysql onto my table "feed". > > I wanted the field ("to_player") to be recognized by web2py. I get > > this error when I try to db.feed.to_player > > > OperationalError: (1054, "Unknown column 'feed.to_player' in 'on > > clause'") > > mysql> show fields from feed; > > +--+--+--+-+-++ > > | Field | Type | Null | Key | Default | Extra | > > +--+--+--+-+-++ > > | id | int(11) | NO | PRI | NULL | auto_increment | > > | account_id | int(11) | YES | MUL | NULL | | > > | to_player | int(11) | NO | | NULL | | > > | date_created | datetime | YES | | NULL | | > > | message | longtext | YES | | NULL | | > > +--+--+--+-+-++ > > 5 rows in set (0.00 sec) > > > Does this make sense in the way on how web2py is structured? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:20227] Custom auth_user problem
Traceback (most recent call last): File "/home/daniel/web2py/gluon/restricted.py", line 98, in restricted exec ccode in environment File "/home/daniel/web2py/applications/tapthat/controllers/ default.py", line 13, in File "/home/daniel/web2py/gluon/globals.py", line 75, in self._caller = lambda f: f() File "/home/daniel/web2py/applications/tapthat/controllers/ default.py", line 7, in user def user(): return dict(form=auth()) File "/home/daniel/web2py/gluon/tools.py", line 403, in __call__ return self.register() File "/home/daniel/web2py/gluon/tools.py", line 657, in register group_id = self.add_group("user_%s" % form.vars.id, description) File "/home/daniel/web2py/gluon/tools.py", line 1072, in add_group group_id = self.settings.table_group.insert(role=role, AttributeError: 'NoneType' object has no attribute 'insert' auth=Auth(globals(),db) # authentication/ authorization #auth.settings.mailer=mail# for user email verification #crud=Crud(globals(),db) # for CRUD helpers using auth #crud.settings.auth=auth # (optional) enforces authorization on crud #auth.define_tables() auth.settings.table_user = db.define_table( "auth_user", db.Field('first_name', length=128,default=''), db.Field('last_name', length=128,default=''), db.Field('email', length=128,default=''), db.Field('password', 'password',readable=False,label='Password'), db.Field('registration_key', length=128,writable=False, readable=False,default=''), db.Field('gender', 'string', default='Male'), db.Field('show_name', 'boolean'), ) table = auth.settings.table_user table.first_name.requires = IS_NOT_EMPTY() table.last_name.requires = IS_NOT_EMPTY() table.gender.requires = IS_IN_SET(['Male','Female']) table.password.requires = CRYPT() table.email.requires = [IS_EMAIL(), IS_NOT_IN_DB(db, '%s.email' % auth.settings.table_user._tablename)] Any ideas? :S --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:20393] Re: Tip of the day: impersonation
Yes we should :) Also, another class/key that checks of the person is impersonating or not. :D @auth.is_impersonating() returns boolean On Apr 23, 3:07 pm, mdipierro wrote: > If you are using Auth you may want to be able to impersonate a > different user without logout and without resetting all your session > variables. > > This is how you can do it > > #optonal: @auth.requires_permission > ('impersonate',auth.table_user,request.args[0] if request.args else 0) > def impersonate(): > """ usagehttp:///impersonate/[id] """ > auth.original_user = auth.user > auth.user = auth.table_user._filter_fields(auth.table_user > [request.args[0]],True) > return dict() > > def un_impersonate(): > if auth.original_user: > auth.user = auth.original_user > auth.original_user = None > return dict() > > You can already do this. Should we make it easier and make them > methods of the Auth class? > > Massimo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:21012] More migration/DAL issues
OperationalError: (1054, "Unknown column 'feed.to_player' in 'on clause'") mysql> show fields from feed; +--+--+--+-+-++ | Field| Type | Null | Key | Default | Extra | +--+--+--+-+-++ | id | int(11) | NO | PRI | NULL| auto_increment | | account_id | int(11) | YES | MUL | NULL|| | date_created | datetime | YES | | NULL|| | to_player| int(11) | YES | MUL | NULL|| | message | longtext | YES | | NULL|| +--+--+--+-+-++ The app @character_required() def index(): friends = db(db.friends.account_id==session.account.id).select (db.friends.friend) thelist = [] for f in friends: thelist.append(f['friend']) if len(thelist) > 0: accounts2 = db.accounts.with_alias("accounts2") rows = (accounts2.id==db.feed.to_player) feeds = db((db.feed.account_id.belongs(thelist))& (db.accounts.id==db.feed.account_id)).select(db.feed.ALL, db.accounts.name, accounts2.id, accounts2.name, left=accounts2.on (rows), orderby=~db.feed.id, limitby=(0, 10)) try: accounts2 = db.accounts.with_alias("accounts2") rows = (accounts2.id==db.feed.to_player) feeds = db((db.feed.account_id.belongs(thelist))& (db.accounts.id==db.feed.account_id)).select(db.feed.ALL, db.accounts.name, accounts2.id, accounts2.name, left=accounts2.on (rows), orderby=~db.feed.id, limitby=(0, 10)) except: feeds = None else: thelist = None feeds = None return dict(feed=feeds) def logout(): if session.has_key('account'): del session.account session.flash = "Logged out of your character" return redirect(URL(r=request, c='account', f='index', args='')) def show(): return dict(message="Test") --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:21117] Table already exists problem [again]
Massimo, I know that we've talked about this in the past, but here we go again... I'm using the latest web2py, in my applications, I would define tables as usual only to get an SQL error saying the table exists. I tried clearing out my "databases" folder, and the only way to clear out would be to delete the database entirely (which is something that I *should not* have to do). According to web2py docs, the DAL handles this type of crap perfectly and just fine. As it should, leave the migration/DAL issues to DAL and not to the user. This is what turned my head towards web2py over Django. Is CREATE TABLE `tablename` IF NOT EXISTS SQL ANSI? Either way, the MySQL handler should perform this rather than just create table under the next patch. It would solve *a lot* of hassle. The problem occurred AFTER I changed my user/pass combo for the MySQL connection string. Could this cause any problems? Someone else had this problem unresolved a long time ago... http://groups.google.com/group/web2py/browse_thread/thread/94a7107c688ad0ef/e244cc0bade80e94?hl=en&lnk=gst&q=auth+user+migrate%3Dfalse#e244cc0bade80e94 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:21156] Re: Table already exists problem [again]
Massimo, Just out of curiosity, how would appending "IF NOT EXIST" to the create table command for MySQL create more problems? This doesn't make any logical sense. Unless you're referring to the ALTER TABLE commands after that, even then I think there is a IF NOT EXIST command within MySQL. Sure, it wouldn't solve for other DBMS, but at least MySQL is having more support, and it's not changing the web2py functionality. If this is still a problem, web2py should have a global migrate command so that you can completely disable migration altogether. Does this function already exist? :S Either way, doing that migrate=false thing, is just a work-around. It isn't focusing on the problem, but rather ignoring it. The weird thing is how does changing the connection string affect the entire migration? I understand if I changed the db name, but changing the user/pass/port/host should be allowed without web2py forcing the re- migrate. On May 4, 10:54 am, mdipierro wrote: > T2 is dead. I will be no longer be supported. In fact much of the T2 > functionality is in gluon.tools > T3 will survive but will be rebuilt on top of tools and events > > Massimo > > On May 4, 9:39 am, Hans > wrote: > > > how to apply this for T2 tables like t2_person? > > would this workaround survive version updates of T2? > > > hans > > > On May 4, 4:23 pm, mdipierro wrote: > > > > This is complex. Currently the way to avoid the problem is to name > > > the .table files via > > > > db.define_table('something',,migrate='something.table') > > > > using "IF EXISTS" would only solve this problem to create others. > > > > Massimo > > > > On May 4, 7:02 am, Hans > > > wrote: > > > > > I'm having a similar problem. Last time I solved it by deleting the > > > > database and setting it up new. With more data it gets a pain. I read > > > > about setting 'migrate=False' to avoid the issue. I could use that for > > > > 'own' tables, but I get the same error for tables created by the T2 > > > > plugin. > > > > Like TheDude also I have changed the user/pass for MySQL connection. > > > > Maybe Web2Py thinks it needs to create the tables new after user/pass > > > > change? > > > > > Traceback (most recent call last): > > > > File "/usr/lib/web2py/gluon/restricted.py", line 98, in restricted > > > > exec ccode in environment > > > > File "/usr/lib/web2py/applications/ips/models/db.py", line 19, in > > > > > > > > t2=T2(request,response,session,cache,T,db) > > > > File "/usr/lib/web2py/applications/plugin_t2/modules/t2.py", line > > > > 98, in __init__ > > > > self._create_tables() > > > > File "/usr/lib/web2py/applications/plugin_t2/modules/t2.py", line > > > > 341, in _create_tables > > > > t=db.define_table('t2_person',T2.base_table(db,'t2_person')) > > > > File "/usr/lib/web2py/gluon/sql.py", line 938, in define_table > > > > raise e > > > > OperationalError: (1050, "Table 't2_person' already exists") > > > > > On May 4, 7:10 am, TheDude wrote: > > > > > > Massimo, I know that we've talked about this in the past, but here we > > > > > go again... > > > > > > I'm using the latest web2py, in my applications, I would define tables > > > > > as usual only to get an SQL error saying the table exists. I tried > > > > > clearing out my "databases" folder, and the only way to clear out > > > > > would be to delete the database entirely (which is something that I > > > > > *should not* have to do). According to web2py docs, the DAL handles > > > > > this type of crap perfectly and just fine. As it should, leave the > > > > > migration/DAL issues to DAL and not to the user. This is what turned > > > > > my head towards web2py over Django. > > > > > > Is CREATE TABLE `tablename` IF NOT EXISTS SQL ANSI? Either way, the > > > > > MySQL handler should perform this rather than just create table under > > > > > the next patch. It would solve *a lot* of hassle. The problem occurred > > > > > AFTER I changed my user/pass combo for the MySQL connection string. > > > > > Could this cause any problems? > > > > > > Someone else had this problem unresolved a long time > > > > > ago...http://groups.google.com/group/web2py/browse_thread/thread/94a7107c68... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:21205] Re: Table already exists problem [again]
I'm going to bump this, it's fairly critical since a few peopl seem to be affected by it. On May 4, 11:26 am, TheDude wrote: > Massimo, > Just out of curiosity, how would appending "IF NOT EXIST" to the > create table command for MySQL create more problems? This doesn't make > any logical sense. Unless you're referring to the ALTER TABLE commands > after that, even then I think there is a IF NOT EXIST command within > MySQL. Sure, it wouldn't solve for other DBMS, but at least MySQL is > having more support, and it's not changing the web2py functionality. > > If this is still a problem, web2py should have a global migrate > command so that you can completely disable migration altogether. Does > this function already exist? :S > > Either way, doing that migrate=false thing, is just a work-around. It > isn't focusing on the problem, but rather ignoring it. The weird thing > is how does changing the connection string affect the entire > migration? I understand if I changed the db name, but changing the > user/pass/port/host should be allowed without web2py forcing the re- > migrate. > > On May 4, 10:54 am, mdipierro wrote: > > > T2 is dead. I will be no longer be supported. In fact much of the T2 > > functionality is in gluon.tools > > T3 will survive but will be rebuilt on top of tools and events > > > Massimo > > > On May 4, 9:39 am, Hans > > wrote: > > > > how to apply this for T2 tables like t2_person? > > > would this workaround survive version updates of T2? > > > > hans > > > > On May 4, 4:23 pm, mdipierro wrote: > > > > > This is complex. Currently the way to avoid the problem is to name > > > > the .table files via > > > > > db.define_table('something',,migrate='something.table') > > > > > using "IF EXISTS" would only solve this problem to create others. > > > > > Massimo > > > > > On May 4, 7:02 am, Hans > > > > wrote: > > > > > > I'm having a similar problem. Last time I solved it by deleting the > > > > > database and setting it up new. With more data it gets a pain. I read > > > > > about setting 'migrate=False' to avoid the issue. I could use that for > > > > > 'own' tables, but I get the same error for tables created by the T2 > > > > > plugin. > > > > > Like TheDude also I have changed the user/pass for MySQL connection. > > > > > Maybe Web2Py thinks it needs to create the tables new after user/pass > > > > > change? > > > > > > Traceback (most recent call last): > > > > > File "/usr/lib/web2py/gluon/restricted.py", line 98, in restricted > > > > > exec ccode in environment > > > > > File "/usr/lib/web2py/applications/ips/models/db.py", line 19, in > > > > > > > > > > t2=T2(request,response,session,cache,T,db) > > > > > File "/usr/lib/web2py/applications/plugin_t2/modules/t2.py", line > > > > > 98, in __init__ > > > > > self._create_tables() > > > > > File "/usr/lib/web2py/applications/plugin_t2/modules/t2.py", line > > > > > 341, in _create_tables > > > > > t=db.define_table('t2_person',T2.base_table(db,'t2_person')) > > > > > File "/usr/lib/web2py/gluon/sql.py", line 938, in define_table > > > > > raise e > > > > > OperationalError: (1050, "Table 't2_person' already exists") > > > > > > On May 4, 7:10 am, TheDude wrote: > > > > > > > Massimo, I know that we've talked about this in the past, but here > > > > > > we > > > > > > go again... > > > > > > > I'm using the latest web2py, in my applications, I would define > > > > > > tables > > > > > > as usual only to get an SQL error saying the table exists. I tried > > > > > > clearing out my "databases" folder, and the only way to clear out > > > > > > would be to delete the database entirely (which is something that I > > > > > > *should not* have to do). According to web2py docs, the DAL handles > > > > > > this type of crap perfectly and just fine. As it should, leave the > > > > > > migration/DAL issues to DAL and not to the user. This is what turned > > > > > > my head towards web2py over Django. > > > > > > > Is CREATE TABLE `tablename` IF NOT EXISTS SQL ANSI? Either way, the > > > > > > MySQL handler should perform this rather than just create table > > > > > > under > > > > > > the next patch. It would solve *a lot* of hassle. The problem > > > > > > occurred > > > > > > AFTER I changed my user/pass combo for the MySQL connection string. > > > > > > Could this cause any problems? > > > > > > > Someone else had this problem unresolved a long time > > > > > > ago...http://groups.google.com/group/web2py/browse_thread/thread/94a7107c68... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:21345] Re: Table already exists problem [again]
Massimo, may I propose a solution here? It would require a lot of work, but if it were done I think it'd destroy the competition of other ORMs :P Anyways, have the ORM/DAL catch any errors presented (not sure if this is possible with GAE). If it *does* catch an error, see which number, have python look up what to do with tht number (e.g. Is a table missing? A field? etc). then it will perform the necessary query SHOW TABLES; SHOW FIELDS FROM [table]; etc. and then re-build the .table file. So it'll constantly load locally until it finds an error. Of course there should also be some kind of throttling mechanism, where if it does see an error but can find a solution, then it'll makr that in like a global.orm.table file so that the next time the error is catched for the same table/field, it would execute any SQL queries and it'll still submit the support ticket of course (may be a support ticket for when DAL figures out the DB on its own as well). I know I know, this is a very complicated system, but I mean, if web2py can completely move the thought process of having to constantly fight with the DB and the app, it would be an awesome feature. :) I know that I'm just dreaming, but a boy can wish can't hey? :'') On May 5, 4:10 pm, Yarko Tymciurak wrote: > someone looked into this, tried some time back ... emulating the kinds of > things that sqlalchamy does; I think he had limited success; not sure I > recall what the summary was. > > On Tue, May 5, 2009 at 2:50 PM, Hans > > wrote: > > > Symlinking the app/database folder would work in environments with up > > to one application server. > > > Unfortunately also I don't know how to query the database table > > structure in all web2py supported databases. But, maybe, we have some > > experts for one or the other supported database on the forum and > > willing to contribute!? > > > On May 5, 9:14 pm, mdipierro wrote: > > > I agree and it does not have to me. The current system does not limit > > > that. It only limits the fact that one app should do migrations. If > > > more than one app may do migrations just symlink the database folder. > > > > Massimo > > > > On May 5, 2:09 pm, Hans > > > wrote: > > > > > IMO one more thing to consider is that a database is not necessarily > > > > exclusively owned by one application. I would even go further and say > > > > default should be a database is NOT exclusively owned by one app and > > > > also not by one framework. > > > > > Currently the problem arises if the .table files of one web2py app > > > > (stored in app/database folder) get out of sync with the database. > > > > To get the .table files of a web2py app out of sync with a central > > > > database is easy. Just have a 2nd app create a table which is also > > > > used by app #1. If app #1 does not set 'migrate=False', including > > > > auth.define_table(migrate=False), this app will not work any more. > > > > Same for app #3, #4, ... Those apps can also be non web2py apps which > > > > automatically create non existing tables, like web2py does it by > > > > default. > > > > > my 2 eurocents > > > > > Hans > > > > > I understand that throwing the default assumption 'the application > > > > owns the database tab > > > > On May 5, 6:13 pm, mdipierro wrote: > > > > > > Yes or perhaps a repair.py script. > > > > > > Massimo > > > > > > On May 5, 10:24 am, Yarko Tymciurak wrote: > > > > > > > On Tue, May 5, 2009 at 9:25 AM, mdipierro > > wrote: > > > > > > > > > > > > > > > The only problems I can see would arise if: > > > > > > > - You delete databases/*.table but the database is still there > > > > > > > (updates do not cause this). Bad luck. One should not delete > > files, or > > > > > > > at least make a backup. > > > > > > > Maybe at some point we can address this w/ some mercurial checkin > > of such > > > > > > important files on a running system... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:21396] Re: Table already exists problem [again]
How is it a problem? We can have the ORM handle specific dbms in a specific way. This isn't a problem, it's merely a translation. The *only* problem, is gathering up all the commands necessary for the different dbms. And I don't see how this could be done with GAE (then again I have *zero* experience with GAE so may be it is possible?) On May 7, 9:21 am, mdipierro wrote: > that's the problem. > > On May 7, 12:39 am, Michal Jursa wrote: > > > Abbsolutely not, SHOW TABLES is MYSQL specific command. Postgres > > implements the same funcionality with SELECT * FROM > > pg_catalog.pg_tables, Oracle makes the same magic with SELECT TABLE_NAME > > FROM USER_TABLES etc etc... > > > Michal > > > mdipierro wrote: > > > hmmm. This may be a good idea. Is SHOW standard SQL? I am not sure all > > > backends support it. > > > > On May 6, 7:05 pm, TheDude wrote: > > >> Massimo, may I propose a solution here? It would require a lot of > > >> work, but if it were done I think it'd destroy the competition of > > >> other ORMs :P Anyways, have the ORM/DAL catch any errors presented > > >> (not sure if this is possible with GAE). If it *does* catch an error, > > >> see which number, have python look up what to do with tht number (e.g. > > >> Is a table missing? A field? etc). then it will perform the necessary > > >> query SHOW TABLES; SHOW FIELDS FROM [table]; etc. and then re-build > > >> the .table file. So it'll constantly load locally until it finds an > > >> error. Of course there should also be some kind of throttling > > >> mechanism, where if it does see an error but can find a solution, then > > >> it'll makr that in like a global.orm.table file so that the next time > > >> the error is catched for the same table/field, it would execute any > > >> SQL queries and it'll still submit the support ticket of course (may > > >> be a support ticket for when DAL figures out the DB on its own as > > >> well). I know I know, this is a very complicated system, but I mean, > > >> if web2py can completely move the thought process of having to > > >> constantly fight with the DB and the app, it would be an awesome > > >> feature. :) I know that I'm just dreaming, but a boy can wish can't > > >> hey? :'') > > > >> On May 5, 4:10 pm, Yarko Tymciurak wrote: > > > >>> someone looked into this, tried some time back ... emulating the kinds > > >>> of > > >>> things that sqlalchamy does; I think he had limited success; not sure I > > >>> recall what the summary was. > > >>> On Tue, May 5, 2009 at 2:50 PM, Hans > > >>> > >>>> wrote: > > >>>> Symlinking the app/database folder would work in environments with up > > >>>> to one application server. > > >>>> Unfortunately also I don't know how to query the database table > > >>>> structure in all web2py supported databases. But, maybe, we have some > > >>>> experts for one or the other supported database on the forum and > > >>>> willing to contribute!? > > >>>> On May 5, 9:14 pm, mdipierro wrote: > > >>>>> I agree and it does not have to me. The current system does not limit > > >>>>> that. It only limits the fact that one app should do migrations. If > > >>>>> more than one app may do migrations just symlink the database folder. > > >>>>> Massimo > > >>>>> On May 5, 2:09 pm, Hans > > >>>>> wrote: > > >>>>>> IMO one more thing to consider is that a database is not necessarily > > >>>>>> exclusively owned by one application. I would even go further and say > > >>>>>> default should be a database is NOT exclusively owned by one app and > > >>>>>> also not by one framework. > > >>>>>> Currently the problem arises if the .table files of one web2py app > > >>>>>> (stored in app/database folder) get out of sync with the database. > > >>>>>> To get the .table files of a web2py app out of sync with a central > > >>>>>> database is easy. Just have a 2nd app create a table which is also > > >>>>>> used by app #1. If app #1 does not set 'migrate=False', including > > >>>>>> auth.define_table(
[web2py:21977] Re: Feature Request: Pagination
Do those examples use the OFFSET paramter? I'm not sure how this affects Oracle or PGSQL, but in MySQL this could be considered a slow query after having 20,000+ rows and exponentially grows from there (I know pgsql has some start-up cost performing this). May want to keep in mind that a better alternative for pagination would be a system like... Have URL() map out a paramter called 'last_seen' and store the last id given from the query results (or you can just increment by "X" value such as 25). Then perform a db(db.table.id > [the parameter]).select (..., limitby(thelimit)). This way, the query performed would look like this: SELECT [fields] FROM [table] WHERE id > [the parameter] LIMIT BY [thelimit]; If you have deleted entries within the DB it *will* mess up. You have several options... - Implement a error margin in the limit by, but during the view set a hard limit using a counter. So if you want 25 results per page, LIMIT BY 40 then in your view as your looping through have a variable called "counter" increment it, once it reaches 25 then break out of the loop. - Implement a system where it finds the first missing ID and insert the new entry with that ID (don't recommend). - An interesting approach would be to have a table with the original table's name then appending it with a "_missing_ids" So if you have the table "users" add another table called "users_missing_ids" and then when you delete an entry from table "users" have the app store the users ID into the missing table. Then, you can just select from that table and inject the ID manually with the new insert row. - Even better, have the DB handle the method above using triggers, functions, procedures, etc. if the dbms can do that. On May 16, 1:15 pm, virhilo wrote: > maybe look at:http://mdp.cti.depaul.edu/AlterEgo/default/show/63 > andhttp://mdp.cti.depaul.edu/AlterEgo/default/show/95 > > On 16 Maj, 18:39, Jason Brower wrote: > > > It would be nice to have integrated pagination, or perhaps some > > documentation on how it's done. And both would be a dream. :D > > I am sure this has been brought up before, but I want to plug it again > > as I really would like this feature in time for my thesis. ;) > > Regards, > > Jason Brower --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:22019] Re: Feature Request: Pagination
Another alternative would be pgsql, oracle might be like killing a fly with a bazooka rather than a fly swatter ;) On May 17, 4:03 am, SergeyPo wrote: > I am using a pagination of <<< 1 | 2 | 3 >>> style in mysql and > Oracle. I agree that OFFSET slows down in MySQL after 20,000 records, > that's why I suggest my clients to use Oracle after their database > grows. > If you are interested in my pager code I can post it here, although > it might be written better. > > On May 16, 10:10 pm, TheDude wrote: > > > Do those examples use the OFFSET paramter? I'm not sure how this > > affects Oracle or PGSQL, but in MySQL this could be considered a slow > > query after having 20,000+ rows and exponentially grows from there (I > > know pgsql has some start-up cost performing this). May want to keep > > in mind that a better alternative for pagination would be a system > > like... > > > Have URL() map out a paramter called 'last_seen' and store the last id > > given from the query results (or you can just increment by "X" value > > such as 25). Then perform a db(db.table.id > [the parameter]).select > > (..., limitby(thelimit)). > > > This way, the query performed would look like this: > > SELECT [fields] FROM [table] WHERE id > [the parameter] LIMIT BY > > [thelimit]; > > > If you have deleted entries within the DB it *will* mess up. You have > > several options... > > - Implement a error margin in the limit by, but during the view set a > > hard limit using a counter. So if you want 25 results per page, LIMIT > > BY 40 then in your view as your looping through have a variable called > > "counter" increment it, once it reaches 25 then break out of the loop. > > - Implement a system where it finds the first missing ID and insert > > the new entry with that ID (don't recommend). > > - An interesting approach would be to have a table with the original > > table's name then appending it with a "_missing_ids" So if you have > > the table "users" add another table called "users_missing_ids" and > > then when you delete an entry from table "users" have the app store > > the users ID into the missing table. Then, you can just select from > > that table and inject the ID manually with the new insert row. > > - Even better, have the DB handle the method above using triggers, > > functions, procedures, etc. if the dbms can do that. > > > On May 16, 1:15 pm, virhilo wrote: > > > > maybe look at:http://mdp.cti.depaul.edu/AlterEgo/default/show/63 > > > andhttp://mdp.cti.depaul.edu/AlterEgo/default/show/95 > > > > On 16 Maj, 18:39, Jason Brower wrote: > > > > > It would be nice to have integrated pagination, or perhaps some > > > > documentation on how it's done. And both would be a dream. :D > > > > I am sure this has been brought up before, but I want to plug it again > > > > as I really would like this feature in time for my thesis. ;) > > > > Regards, > > > > Jason Brower --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:22058] Re: Hoping to increase my connections to web2py people on linkedIn
People are discussing this in the IRC chat already. Just needs a bit of a push ;) On May 18, 12:07 am, mdipierro wrote: > I have a better idea. A web2py app that provides: > - web pages for developers/contributors/users > - a database of projects (could replace appliances) > - a database of code snippets (could replace AlterEgo) > - a wiki > - forums > > I think we could just build this by integrating existing components. > Any volunteer to help? > > Massimo > > On May 17, 10:37 pm, Jason Brower wrote: > > > Could we have a web2py linkedIn group? > > I think it would be nice to have a network on linkedIn loving people > > there. > > Regards, > > Jason Brower --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:22061] Re: web2py 1.62.0 posted
Got this on initial startup: Traceback (most recent call last): File "web2py.py", line 20, in gluon.widget.start(cron=True) TypeError: start() takes no arguments (1 given) I re tried, it worked the second time. So, if anyone gets this, well just retry. ;) Im on ubuntu hardy. As for testing out things, I'm using downloader for images, a simple image gallery, and auth() for several things and it all seems to be working just fine :) It is 6:20 am and I havent slept at all, I think im developing insomnia :P Anyways, going to the gym but will check more of it later today and try to test some things out. db.table.field.isattachment = True admin.py by Alvaro new MENU helper Can you explain these changes a bit more in depth? The admin panel looks the same to me. On May 18, 2:56 am, mdipierro wrote: > Please give it a try and let me know. > > Massimo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:22062] Re: web2py 1.62.0 posted
Running into two problems: 1) The welcome.w2p tried to upload it, it says that it cannot be installed (no error message) 2) I upload welcome.tar, works fine, I go to the website then go back to the admin interface. It logs me out of the admin interface and when I go to type in my password it says invalid. I have to stop the server, change pass (or keep it the same), then hit start server in order to be logged in correctly. Also, the welcome.tar doesn't look any different (may be I didn't extract correctly? I tried extracting several times and I do have correct permissions to the folder). Hope this helps :) On May 18, 6:22 am, TheDude wrote: > Got this on initial startup: > Traceback (most recent call last): > File "web2py.py", line 20, in > gluon.widget.start(cron=True) > TypeError: start() takes no arguments (1 given) > > I re tried, it worked the second time. So, if anyone gets this, well > just retry. ;) Im on ubuntu hardy. > > As for testing out things, I'm using downloader for images, a simple > image gallery, and auth() for several things and it all seems to be > working just fine :) It is 6:20 am and I havent slept at all, I think > im developing insomnia :P Anyways, going to the gym but will check > more of it later today and try to test some things out. > > db.table.field.isattachment = True > admin.py by Alvaro > new MENU helper > > Can you explain these changes a bit more in depth? The admin panel > looks the same to me. > > On May 18, 2:56 am, mdipierro wrote: > > > Please give it a try and let me know. > > > Massimo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:22066] Re: DB information on menu
Why not define it as you would with any table? If it's already within the database, add a migrate=False option :) On May 18, 7:50 am, Tito Garrido wrote: > Hi Folks! Thank you for yours answers! > > In fact what a really want is to get db data from a previously defined > database on db.py. > I have a table there called "album" and I'd like to get those albums to > build a menu like on Maximo's example, but getting it from a table defined > on db.py. > > Any ideas? > > Tito > > > > On Sun, May 17, 2009 at 11:47 PM, Jason Brower wrote: > > > Shucks, you beat me to it! > > > On Sun, 2009-05-17 at 19:32 -0700, mdipierro wrote: > > > Yes, I think some like this should do it. > > > > db.define_table('menu_item', > > > SQLField('name'), > > > SQLField('link'), > > > SQLField('position','integer'), > > > SQLField('parent','integer',default=0)) > > > > def menu(table=db.menu_item): > > > items=table._db(table.id>0).select(orderby=table.parent| > > > table.position).as_list() > > > parent=0 > > > p={0:[]} > > > for item in items: > > > p[item.id]=[] > > > p[item.parent].append([item.name,True,item.link,p[item.id]]) > > > return MENU(p[0]) > > > > {{=menu(db.menu_item)}} > > > > On May 17, 8:23 pm, Tito Garrido wrote: > > > > Hi... > > > > > How can I use DB data on menu? > > > > I'd like to use db data to build a submenu on menu.py... > > > > > Thanks! > > > > > Tito > > > > > -- > > > > Linux User #387870 > > > > . > > > > _/_õ|__| > > > > ..º[ .-.___.-._| . . . . > > > > .__( o)__( o).:___ > > > > Sent from Salvador, BA, Brazil > > -- > Linux User #387870 > . > _/_õ|__| > ..º[ .-.___.-._| . . . . > .__( o)__( o).:___ > Sent from Campinas, SP, Brazil --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:22103] Re: web2py 1.62.0 posted
Massimo, what did you fix? Just the recaptcha? Also, Im using python 2.5 if that helps :) On May 18, 10:57 am, mdipierro wrote: > This is a problem. I fixed and posted 1.62.1. Thanks for letting me > know. > > On May 18, 8:34 am, Vidul Petrov wrote: > > > Although the modules are imported (from gluon.tools import *) I get > > this error: > > > NameError: name 'Recaptcha' is not defined > > > On May 18, 9:56 am, mdipierro wrote: > > > > Please give it a try and let me know. > > > > Massimo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:22150] Re: another web2py powered
What website is it? On May 19, 4:30 am, Yarko Tymciurak wrote: > This is nonsense - > > None of the contact information or registry about the site or domains is > true - all phone numbers, in registry and on the site itself are > disconnected numbers; no name this is registered under is true; the site > uses deceptive practices to lure users into registering to buy "bid > permissions" - deceives by repeatedly flashing "only a few seconds left" on > countdown timers, which in reality are false - the bid ends sometime next > month, the times reset repeatedly to something around 10 minutes. I can't > even use the words I want to describe this kind of web-site behavior. > > Even the vendor information that PayPal has is not accurate or complete - > the only phone number that was NOT disconnected was from PayPal, and to a > cell phone - if this was the "business person" then the person answering > claimed he "didn't know anything about it", said he was getting a lot of > calls about this site, and *asked me if I could spell it*. > > Either it was a wrong number, or a deceptive website owner. Either way, > same red flags. > > Everything about this site is wrong. > > That email saying it's not a scam? Maybe he could update his registry > entries first - correct his contact information - you know, the simple > business stuff: Name; Address; Phone number. > > Heck, even his "address" listed on his website is nothing more than the > address of teh Palo Alto US Post Office. > > If this is not a scam, then here's something else it's not: up-front and > honest. > > I have the long version details - how the "disconnected" phone numbers are > similar modifications of the one that works, listed with PayPal. > Everything about it "smells" intentional, not accidental. The registry is > recent. It should be correct. > > Who is it we're trying to kid here? No one but yourself. Get responsible. > > - Yarko --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:22152] Re: how to create index on a database table
Hmm may be we can add an "index=True" option? Even better have something like: db.add_index('table', 'name_index_as', ['field1','field2'], unique=True) It'll add an index with multiple fields, unique=True is obviously optional. However, this may be to much work, and may be focusing ont he actual web part rather than the ORM is more important. :P On May 19, 7:04 am, benqktc wrote: > adding 'unique=True' to SQLField causes web2py to implicitly create > unique index on that column, that works for me. > > but what if i just want an index not an unique index. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---