The options actually are listed in the main documentation (though not in the API docs) here:
It would have helped me if the anvil.server Globals section specified their type: that context
is an instance of anvil.server.CallContext
(and likewise for request
).
A couple users have recently thought they needed to purchase their own SSL certificate to use a custom domain, so it might be good to add something to the publish interface or docs explicitly saying that that is not necessary.
Please clarify which code and which database gets cloned. Based on my testing just now, it’s the master branch and the Debug database, but it would be helpful to have that spelled out.
When trying to implement Stripe charging on the server. I followed the documentation code below…
@anvil.server.callable
def add_card(token, email):
user = anvil.users.get_user()
if user['stripe_id'] is None:
customer = anvil.stripe.new_customer(email, token)
user['stripe_id'] = customer['id']
else:
customer = anvil.stripe.get_customer(user['stripe_id'])
customer.add_token(token)
I think the last code line - customer.add_token(token)
is in the wrong place. Should it not be…
@anvil.server.callable
def add_card(token, email):
user = anvil.users.get_user()
if user['stripe_id'] is None:
customer = anvil.stripe.new_customer(email, token)
user['stripe_id'] = customer['id']
else:
customer = anvil.stripe.get_customer(user['stripe_id'])
customer.add_token(token)
as the adding of token is only applicable in the case of an existing Stripe customer found. For a new Stripe customer is created with a token added.
When saving an older app to GitHub, I happened to have a feature branch checked out in the IDE. I was surprised to find that that branch was thus set to be the default branch in GitHub, rather than master
. (It’s not a huge inconvenience to change that in GitHub, assuming doing so isn’t going to mess up the Anvil integration, but still.) It would be helpful to add a heads-up to that effect to the docs, if I’m understanding correctly how it worked: that the currently checked-out branch when saving to GitHub is set to the default in the GitHub repo.
The get_url(False)
option for media files in data tables:
The wellknown_endpoint
decorator:
anvil.designer.in_designer
Yesterday, I went to find the documentation on the accelerated tables feature q.fetch_only()
. Unfortunately, I could not find it in the docs and had to come to the forum to jar my memory about what the name of that method was.
It would be great if it were included in the docs and especially the API Reference.
Thanks!
This one actually is in there, though a little hard to find. Look under the Explicit Cache Control subheading here:
https://anvil.works/docs/data-tables/accelerated-tables#new-features
Searching for api methods in the documentation rarely returns useful results. I often use Google, which is much better at finding the right Anvil pages than Anvil itself. (I do the same when I search MSDN, because often neither Bing nor the MSDN search tools are able to find the correct pages in their very own MSDN).
A search like this will work: site:anvil.works/docs fetch_only
.
Said that, Google will immediately take you to the only page containing the word fetch_only
, which would have helped you a little, but the fetch_only
method seems to be missing in the API reference docs.
For Design-time interactions with Custom Components, document how the Designer interacts with the component.
For example, what’s the component’s parent
? Is that reference even valid?
Code always runs in some kind of environment. If the environment differs from the one it’s been programmed for, it’s going to misbehave, and distract the developer.
It’s one thing for a component to be able to tell which environment it’s running in. It’s something else for the developer to know how those environments differ, so that they can update the old components (or build new ones) to behave appropriately for each environment.
In this page: Anvil Docs | Basic Components there’s a section on scrolling a component into view. That section does not mention the argument to scroll_into_view
that allows smooth scrolling, and probably should.
The argument is listed in the API reference for Component, but that isn’t linked to from the section above.
The doc pages for the Material 3 Beta contain links to API documentation that doesn’t presently exist.
For example, https://anvil.works/docs/ui/app-themes/material-3/layouts contains links to (https://anvil.works/docs/api/material_3#NavigationDrawerLayout).
For another, https://anvil.works/docs/ui/app-themes/material-3/components contains a link to https://anvil.works/docs/api/material_3#Text.