question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding views in decorators

See original GitHub issue

Adding new views in decorators that depend on the date seems extremely buggy.

Steps to reproduce: Create a CalendarCellDecorator that adds a TextView to the CellView containing the provided date only if the day of the month is 30.

Expected behavior: The date is the same as the date shown on the original TextView and the new view only appears the 30th of the month.

Actual behavior: The date always says 30, but the view appears on dates that are not the 30th of the month.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:22

github_iconTop GitHub Comments

1reaction
magneticflux-commented, Jun 30, 2017

@edenman I’m going to try to isolate it down to the simplest setup that reproduces it in the sample app.

0reactions
magneticflux-commented, Jun 30, 2017

In addition, the fact that decorators operate inside of a layout pass means that merely setting the background drawable of a cell results in dozens of warnings like the following:

06-30 16:37:40.032 12213-12213/com.squareup.timessquare.sample W/View: requestLayout() improperly called by com.squareup.timessquare.CalendarCellView{9a3559c VF....C.. ......ID 0,0-142,142} during layout: running second layout pass

I think a fix for this and several other issues would be to move all of the decoration loop out of the layout stage and later in the setup of the views, but I don’t know how that could be accomplished. This seems to relate to #103.

Read more comments on GitHub >

github_iconTop Results From Across the Web

View decorators - Django documentation
The decorators in django.views.decorators.http can be used to restrict access to views based on the request method. These decorators will return a django.http....
Read more >
Working with Django View Decorators
Both view functions can only be accessed by the entry owner and we don't need to add the if statement inside each of...
Read more >
Tidy Views and Beyond with Decorators - Thoughtbot
It is an object that wraps another object adding any required functionality, and proxies the interface you care about to original decorated ...
Read more >
How do I set a decorator for every one of my Django views?
You can decorate all your views in urls.py: http://djangosnippets.org/snippets/532/ . Share. Share a link ...
Read more >
Creating custom decorators for your views - Packt Subscription
Next, you will create a decorator for checking the HTTP_X_REQUESTED_WITH header in your views. A decorator is a function that takes another function...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found