[web2py:23262] Trouble with upload + uploadfield to put images in db

2009-06-04 Thread cjparsons
I want to store images in the database and I'm having trouble with my SQLFORM. I've copied the example from the manual but find that the image doesn't go into the database on 'new'. I'm on web2py Version 1.63.3 Apologies in advance if it's a typo. 1) With no argument (="insert" form) I get an ex

[web2py:23829] Re: logging approach

2009-06-10 Thread cjparsons
I was involved in the older thread and went ahead used the logging module and haven't had any problems logging to file and to MySQL. I did a bit more research and think it's thread safe. But I haven't had many concurrent users so YMMV. Chris On Jun 9, 4:04 am, mdipierro wrote: > I forgot. Thanks

[web2py:24410] Re: Time

2009-06-18 Thread cjparsons
> What if server > is in East Kazakhstan and the user is in Hackensack, New Jersey? What > time zone is request.now?) If the server and user are in different time zones I don't believe there's an easy solution, especially when you consider daylight saving time (i.e. just converting everything to

[web2py:24699] Re: Request.now.hour

2009-06-22 Thread cjparsons
It is better to store times as 'times' in the database rather than muck about with times in string format. A lot better. I think this controller model / code will do what you want (note that I didn't make a 'weekday' table and I force the current seconds to zero to you get results that start duri

[web2py:24702] Re: Request.now.hour

2009-06-22 Thread cjparsons
> One way of disabling the time picker is to remove the line > try { $("input.time").clockpick({     starthour:0, endhour:23, > showminutes:true, military:true}); } catch(e) {}; > from web2py_ajax.html in 'views'. Another way would be do use jquery > to remove the clockpick class from the input fi

[web2py:24767] Re: Request.now.hour

2009-06-23 Thread cjparsons
> I have two more questions though: > > In the interface the time displays like 15:00:00 how do I get it do > display in the format: 15:00? Changing your widget to the following will change the way the time appears in forms: def timeplain(field,value): if value == None: value

[web2py:24768] Re: Request.now.hour

2009-06-23 Thread cjparsons
> Changing your widget to the following will change the way the time > appears in forms: Apologies, my formatting of the code made it unreadable. Reposting the modified widget that formats the time without seconds: def timeplain(field,value): if value == None: value = ''

[web2py:24769] Re: Request.now.hour

2009-06-23 Thread cjparsons
> In my model I also have a widget which reads like: > > db.event.plaats.widget=lambda self,value:INPUT > (_type='text',_id='place',_class='ac_input',_name='plaats',value=str > (value),requires=self.requires) > > The widget Chris provided me with reads like: > > def timeplain(field,value): >     i

[web2py:24786] Re: Request.now.hour

2009-06-23 Thread cjparsons
> In my case, I would create a widgets.py file in the modules folder of > my application, put the widget code in widgets.py, in my model import > the widgets (from modules import widgets) and use it like this: > widget=timeplain. Wouldn't I? Very nearly! Since your web site is running as part of w

[web2py:24872] Re: Request.now.hour

2009-06-24 Thread cjparsons
If you're still having problems with this then please post the error message you receive and the relevant parts of the actual code. Whilst I and others are keen to help I'm afraid I don't have time to trace through everything above, and I don't understand the ??? parts. Warm regards, Chris. --~--~

[web2py:25230] Re: maintain dictionary state between requests

2009-06-29 Thread cjparsons
Session data is normally stored on disk in the "sessions" folder in python pickle format - only the session id is transferred over the network connection between the client and the server. (I say "normally" because there is also an option to store session data in the database, though this has to b

[web2py:25239] Re: Idea... Thumbnailing...

2009-06-29 Thread cjparsons
I've had success with PIL to thumbnail uploaded images. In upload form handling: if form.accepts(request.vars,session): if not form.vars.get("delete_this_record",False): response.flash = "image accepted" makeThumbnail(form.vars.id) else: response.flash =

[web2py:12489] IS_IN_DATASET validator for filling SELECT with data from code not database

2008-11-25 Thread cjparsons
I wanted to have a field on an SQLFORM that behaved like IS_IN_DB (i.e. a drop box with values shown to the user and a corresponding id inserted into the database). I didn't want to take the source data from the database though because it is more program data than user data and I wanted to use in

[web2py:12496] Re: IS_IN_DATASET validator for filling SELECT with data from code not database

2008-11-25 Thread cjparsons
Ah, thought there must be an existing way of doing it but I didn't realise you could use 'labels=' with IS_IN_SET :-) On Nov 26, 1:59 am, DenesL <[EMAIL PROTECTED]> wrote: > cj, wouldn't that be equivalent to: > > db.table.myField.requires=IS_IN_SET([0,1,2],labels=[T('Alpha'), T > ('Beta'),T('Gam

[web2py:12588] Re: web2py book in PDF at $12.50

2008-11-28 Thread cjparsons
For an index I guess Joe means a hyperlinked index / table of contents where you can click on an entry to go to the page. This would need to be generated by re-PDFing the original document I guess. I made the document easier to view in the small window of my eee pc by using printing the PDF I dow

[web2py:13854] Decorators in controller file called for all functions whether decorated or not

2008-12-19 Thread cjparsons
If I have a controller file as below I find that the decorator() function is called when any controller in the file is called not just the decorated ones. i.e. If I access /application/default/index I see "decorator called" as well as when I access /application/default/ index2. Am I doing somethin

[web2py:13939] Re: Decorators in controller file called for all functions whether decorated or not

2008-12-20 Thread cjparsons
Thank you, Yarko, i've seen examples like your most recent before but now I think I finally get it. Do you think this is a good way of doing validation-if the validation fails a controller indicating an error is returned instead of self.f()? --~--~-~--~~~---~--~~ Yo

[web2py:15036] '=' used for padding urlsafe_b64encode() confusing web2py when in URL arg

2009-01-16 Thread cjparsons
Depending on the size of the input string, urlsafe_b64encode() padds the resulting string with '=' characters. If the generated string is used as a URL argument e.g. http://localhost:8000/default/app/controller/function/DxFOVxWvvzGdOSh2ARkK-2XPXNavnpiCkD6RuKLffvA= Then I appear to get an "inval

[web2py:15055] Re: Questions and Introduction

2009-01-17 Thread cjparsons
Hi Mick I'm far from being an expert but I'll try and be helpful.. web2py follows the Model-View-Controller arrangement for web applications. This approach is now common in many web frameworks because it allows you to separate different aspects of the application. In a large project they might b

[web2py:16212] Linking to an anchor within a view

2009-02-12 Thread cjparsons
I have a page that contains mainly text information in the view arranged in sections with labels. I've not put it in 'static' because I want to use views/layout.html. How can I link from another page to a particular section? I've tried putting '#secname' at the end of the f= parameter in {{=URL(

[web2py:16222] Re: Linking to an anchor within a view

2009-02-12 Thread cjparsons
On Feb 12, 1:25 pm, Kacper Krupa wrote: > {{= URL(r=request, c='controller', f='function', args='#arg') }} > or > {{= URL(r=request, c='controller', f='function', args=['#arg']) }} > > ? > No, that gives an '

[web2py:16229] Re: Linking to an anchor within a view

2009-02-12 Thread cjparsons
Massimo > > On Feb 12, 9:10 am, mdipierro wrote: > > > > > sorry I misunderstood the question. perhaps URL should have an achor > > argument keyword. > > > Massimo > > > On Feb 12, 9:02 am, Kacper Krupa wrote: > > > > The only way what i

[web2py:16557] Persisting user log in

2009-02-19 Thread cjparsons
I'd like a bit more understanding about how web2py handles cookies and the 'session' variable. When a user logs in I want to offer the option of keeping their log in on this computer (if not using a public computer). My mechanism at the moment is to store information in the session including an e

[web2py:16559] Re: Persisting user log in

2009-02-19 Thread cjparsons
Thank you, as ever, Massimo, for your devotion and advice! > The lack of client-size expiration which is an > attribute of the cookie itself, is the reason why they are not > persistent. This can be easily changed. This was my point of my not-understanding about the expiry. The use of the HMAC

[web2py:16583] Re: Persisting user log in

2009-02-19 Thread cjparsons
On Feb 19, 1:32 pm, mdipierro wrote: > To set the expiration for the session cookie and thus making it > persistent just do: > >     response.cookies[response.session_id_name]['expires']="Fri, 3 Aug > 2009 20:47:11 UTC" For some reason I'm doing this wrong. If I log the contents of 'response' I

[web2py:16599] Re: Persisting user log in

2009-02-19 Thread cjparsons
you want to expire a session server side you need to do > it via a session variable. Settings "expires" in the cookie should > indicate your browser that the browser should not send back to the > server this cookie after the expire time. I am not sure how browsers > really h

[web2py:16788] Re: URL & Controller question

2009-02-23 Thread cjparsons
1. One way is to use the routes.py script in the web2py directory to rewrite URLs, assuming you are using web2py's built in web server. There are instructions in the script. Ask here again if you're not sure 2. All functions are exposed in controllers except: - any function that takes an argument

[web2py:16926] Re: Critical point in web2py

2009-02-25 Thread cjparsons
Very keen to see centralised (well organised)documentation, and to help where I'm able. I think it's better to use an established Wiki/code framework. It would be nice to have a solid feature-full wiki in web2py. Less time developing / maintaining a web2py-wiki means more time enhancing and docum

[web2py:17058] Re: Critical point in web2py

2009-02-27 Thread cjparsons
If you agree it would be good to think about structure before we start (e.g even http://mdp.cti.depaul.edu/examples/default/docs is a bit overwhelming) I made a "documentation organisation" page on the test wiki. Please edit/delete what I put there already and / or comment. https://mdp.cti.depaul

[web2py:17064] Re: Critical point in web2py

2009-02-27 Thread cjparsons
> Use the wiki for the initial gathering of doc pages, then after the > first sphinx-based documentation is produced,  just clean the wiki of > those pages.  After that, just use the wiki for contributed recipes > and other pages, some of which are selectively migrated to sphinx. > Keep the change

[web2py:17463] "commands out of sync" on simple migration with MySQL & 1.55 or 1.57

2009-03-04 Thread cjparsons
I made a change to one of my models to increase the size of a VARCHAR field from 64 to 138. I'm using MySQL 5.0.51a-3ubuntu5.4 and web2py 1.57. I had the same problem with web2py 1.55. The SQL shown in sql.log is: timestamp: 2009-03-04T08:24:03.934903 ALTER TABLE meetups ADD entry_key__tmp VARCH

[web2py:17529] Re: "commands out of sync" on simple migration with MySQL & 1.55 or 1.57

2009-03-05 Thread cjparsons
> First, drop the row. > Second, add the row again with the new size Yes, this resulted in a migrated table with the new field having the correct size and no errors. (obviously I lost the data in the field). I can't see how the migrate commands written in sql.log are different from when I hand-

[web2py:18482] Re: Full documentation

2009-03-23 Thread cjparsons
A lot of free documentation is available, including example code in the posts on this mailing list. The web2py book is very reasonably priced, especially in PDF form. As I understand it, the documentation is in the form of a proper publication because Massimo has developed web2py in the context o

[web2py:18480] Re: How to hide the console window?

2009-03-23 Thread cjparsons
I have renamed web2py.py to web2py.pyw and then start web2py using a shortcut with target set to \web2py.pyw -t You need to have .pyw appropriately set up as a file type in windows explorer for this to work I think. I had installed a windows distribution of Python before I had web2py, and I the in

[web2py:22356] Re: args and vars

2009-05-22 Thread cjparsons
It's evil and horrific but if you're desperate you could maybe at the start of the function store the arguments in the session then redirect to the same function, without the arguments in the URL. At the start of the function, check for the details in the session, store them in a local variable a

[web2py:10264] Re: Logging

2008-10-15 Thread cjparsons
"logging in" or as in "logging module"? > > On Oct 15, 4:31 am, cjparsons <[EMAIL PROTECTED]> wrote: > > > > > Are there any clever ways for debug logging? I am planning to use the > > Python logger module to a file in the administration direct

[web2py:10259] Logging

2008-10-15 Thread cjparsons
Are there any clever ways for debug logging? I am planning to use the Python logger module to a file in the administration directory which I guess will only be visible if logged in? Thanks for any ideas you have Chris --~--~-~--~~~---~--~~ You received this messa

[web2py:10351] Seeing changes made to a module in app/modules without restarting web2py

2008-10-17 Thread cjparsons
I have some helper functions in applications/[application]/modules/ helperFunctions.py. I import that in my controller using the full path applications/ [application]/modules/helperFunctions I find that if I make changes to helperFunctions.py web2py doesn't see them until I restart web2py. Is th