I have a file uploads table and want to have a unique, random code for
each file as it is uploaded, so that my fields are id, file, code,
where 'code' is generated by a given function (say, for sake of
argument, randint(10,99)).
Is this something I can do in the model, or do I need a form
sion,
onvalidation=my_form_processing)
session.flash = 'record inserted'
redirect(request.url)
return dict(form=form)
Does the 'my_form_processing' function go in the model or the
controller?
On May 18, 2:09 pm, scausten wrote:
> I have a
I've been trying to get images into my css (both stored in static),
using URL() to pull the image, but because of the relative path from
the css to the image folder, and the fact that URL() returns a url
from the root(?), I'm having trouble with the syntax - is there a
standard way of doing this?
I'm adding files content to my database with the following code being
called onvalidation when the form is submitted. It really simply
generates a 6-digit alphanumeric code as an identifier for the file:
codes = db().select(db.products.code) # Grabs all the existing codes
from the database
while
tbbooks.id == 1).count()
>
>
>
> On Wed, May 26, 2010 at 2:44 PM, scausten wrote:
> > I'm adding files content to my database with the following code being
> > called onvalidation when the form is submitted. It really simply
> > generates a 6-digit alphanumeric c
I'm implementing PayPal on my site and would like to know the best
practice for securely storing my API credentials (user, pass,
signature).
Can this go in the database (say in a 'credentials' table), or should
it be elsewhere?
I'm trying to download (using urllib.urlretrieve) a remote file into
my application. It's a zip file containing an IP-to-country lookup
table. I want to download the zip to the application's file system
(probably 'uploads'), unzip it, process the csv and then import the
sanitised data into my ip-to
Should have tried harder myself - this works, but is there a better
way of doing it?
filename, headers = urllib.urlretrieve(link, path.join(os.getcwd(),
"applications", request.application, "uploads", "foo.zip"))
On Jun 18, 1:56 pm, scausten wrote:
&
There's a really cool feature in the CakePHP web framework whereby you
can query a database recursively and have a query return not only the
records of a given query, but also any other records they refer to,
and I was wondering if there's anything similar in web2py. (There is a
'recursive' flag in
I'm an idiot. I actually hadn't tried the transaction.product.name
syntax, and lo-and-behold, it works.
web2py is awesome.
On Jul 22, 8:31 pm, scausten wrote:
> There's a really cool feature in the CakePHP web framework whereby you
> can query a database recursively and ha
Hi,
Bit of a noob question (sorry) but I'd like to add a page "/user/
combinedLogin" to my app, which combines the login and register forms,
but can't work it out. This:
if request.args(0)=="login":
=auth.login()
=auth.register()
works fine, but I'd like to expose a new url (/user/combin
3 pm, mdipierro wrote:
> How about
>
> {{extend 'layout.html'}}
> Login
> {{=auth.login()}}
> Register
> {{=auth.register()}}
>
> On Apr 22, 3:49 pm, scausten wrote:
>
>
>
> > Hi,
>
> > Bit of a noob question (sorry) but I'd like to add a
I've noticed that Zencoding doesn't highlight code when editing .load
views for components, so I find myself doing all my editing in a .html
view, then copying the whole thing over into my .load view and
removing my {{extend}}.
Firstly it would be cool if zencoding could be made to treat .load
vie
Would it be possible to add the ability to pass _class (in the same
way as with HTML Helpers) to the LOAD function, i.e.:
{{=LOAD('default', 'foo.load', ajax=True, _class="bar")}}
to generate
loading...
Or is there a better way?
Does anyone have ideas on how to implement an upload 'queue'?
Specifically, my site allows users to upload mp3s, but I'd like to
defer the uploading of submitted files when a form is submitted so
that the user can continue browsing the site while their file uploads
in the background.
Ideally I'd l
Hi Massimo,
I've tried to install web2py on vps.net today and I'm getting the
following error message:
./setup-web2py-ubuntu.sh: line 4: syntax error near unexpected token
`newline'
Could you have a look at it please?
On Sep 23, 4:36 am, mdipierro wrote:
> yes this should do it
>
> sudo /etc/
Don't worry, I was doing something extraordinarily stupid - the script
is fine.
On Sep 23, 2:05 pm, mdipierro wrote:
> I do not see anything wrong with line 4
>
> On Sep 23, 5:25 am, scausten wrote:
>
>
>
> > Hi Massimo,
>
> > I've tried to install
Another bump - has anyone had any further thoughts on how to get
web2py-component-command or web2py-component-flash working with this
code?
On Oct 13, 1:38 pm, selecta wrote:
> *bump*
> sinceuploadforms do not work in web2py components anyway this code
> could be integrated into web2py without th
}});
});
{{pass}}
It's ugly, but it seems to work ok for simple stuff...
On Oct 25, 9:37 am, scausten wrote:
> Another bump - has anyone had any further thoughts on how to get
> web2py-component-command or web2py-component-flash working with this
> code?
>
for eval since the script will be interpreted anyway
>
> On Oct 25, 11:23 am, scausten wrote:
>
>
>
>
>
>
>
> > I've had some success with a very simple workaround for web2py-
> > component-command. In the form.accepts in my SQLFORM, I set a variable
&
I've got a few items of supplementary data about my users relating to
my e-commerce app, including current balance, total earnings, and
other bits and pieces. Because these are not directly related to
access control, I have a gut feeling that I should store them in a
different table and have a sing
Thanks Bruno - just out of interest, why do you prefer to use
db[auth.settings.table_user_name] over db.auth_user?
On Jan 20, 8:01 pm, Bruno Rocha wrote:
> But, if you want a customized auth_user table, here is a good example
>
> https://bitbucket.org/hc/scanme/src/743ed270faae/models/db_scanme.p
I'm using Janrain and I need to perform some actions post-
registration, but the usual auth callbacks don't seem to be working.
I'm running a very simple test function in my model:
db.define_table('user_data',Field('testfield'))
auth.settings.register_onvalidation.append(lambda
form:db.user_data.i
I'm having the same trouble with the following table definition (version
2.0.8)
db.define_table('clients',
Field('name'))
db.define_table('promotions',
Field('client', 'reference clients'),
Field('name'),
Field('star
gt;
> Il giorno mercoledì 12 settembre 2012 17:28:50 UTC+2, scausten ha scritto:
>>
>> I'm having the same trouble with the following table definition (version
>> 2.0.8)
>>
>> db.define_table('clients',
>> Field('name'))
>&g
One of the awesome things about web2py is of course the built-in and
well-documented resilience against a range of attack methods, but I was
wondering if anyone has attempted a methodical (white-hat) attack to probe
any potential weaknesses?
Just out of interest :)
I'd like to asynchronously load one of a choice of components into a
view, based on a user selection after the page has loaded. It's
relatively trivial to do this by changing the src on an iFrame which
embeds the component view, but this doesn't feel like a web2py-ish way
of doing things.
It would
Thanks! web2py easy, as always.
On Jan 28, 11:24 am, Alan Etkin wrote:
> You can use javascript onclick and the web2py.js function
> web2py_component(action,target) to load the source on demand.
> You need to set a target div or other element in the view previously
> and get the triggered event's
Is is possible to hold a record in session, something like:
id = db.transactions.insert()
session.transaction = db.transactions[id]
and directly update_record the session.transaction,
session.transaction.update_record(x=y)# This throws KeyError:
'update_record'
or is it necessary to res
29 matches
Mail list logo