Anvil Documentation Suggestions [ON-GOING]

More Documentation on PDFRenderer

I was looking to reduce the pdf size generated by PDFRenderer and went to the docs! The quality optional argument looks like the worker for the job, but I am sure what the acceptable options are, based off of the docs. I found a couple of post showing different quality options I am trying, but having it explained clearly in the docs would be great!

The other options would be great to get the explanations as well.

Thank you anvil team! :slight_smile:

1 Like

See

1 Like

The options actually are listed in the main documentation (though not in the API docs) here:

1 Like
1 Like
1 Like

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).

1 Like

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.

5 Likes
2 Likes
1 Like

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.

1 Like

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.

2 Likes

The get_url(False) option for media files in data tables:

1 Like

The wellknown_endpoint decorator:

1 Like

anvil.designer.in_designer

1 Like

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

1 Like

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.

3 Likes

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.

2 Likes