Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Ethan Miller
@ezmiller
like query.all() sort of == query.pagination() except or the inclusion of a limited set and teh Meta pagaination data?
Benjamin Kampmann
@gnunicorn
yes
Ethan Miller
@ezmiller
okay data comes into PrivateMessage schema
PrivateMessage schema renders it
then that goes through MorphingSchema that has this pre_dump decorated set of methods
Benjamin Kampmann
@gnunicorn
that return value is gathered by the PagingSchema and all of them put together into the data=[]-list
Ethan Miller
@ezmiller
oh no ony the first one there is decorated
Benjamin Kampmann
@gnunicorn
yes. that is to select which sub-schema to use.
that happens before starting to dump
Ethan Miller
@ezmiller
Okay
Benjamin Kampmann
@gnunicorn
and essentially makes it “morph” into the target schema
(actually it returns a new schema, which the surrounding code understands as “please use this schema instead”)
Ethan Miller
@ezmiller
So it’s query.pagination() -> PaginationSChema -> MorphingSchema -> (target schema) PrivateMessageSchema?
Benjamin Kampmann
@gnunicorn
these are mostly lib specific things though. marshallow kinda forces us to do that way, if we want to use. we could also do the JSON dumping differently, use different APIs or do it by hand. The nice thing about schemas is, that it is very explicit what will be rendered and how and you can even use those to “validate” incoming data...
(not that we are doing that at the moment)
yes
alright. bed time now :)
you good for now?
otherwise write stuff and I’ll answer it first thing tomorrow morning.
Ethan Miller
@ezmiller
Yes, I think I need to chew on that a bit.
thanks!
Benjamin Kampmann
@gnunicorn
it is complex, so take your time :)
Night!
Ethan Miller
@ezmiller
Nigthy night.Thursday still works?
Ethan Miller
@ezmiller
Some additional questions, more specific:
Benjamin Kampmann
@gnunicorn
morning.
yes, thrusday is still scheduled for me.
Ethan Miller
@ezmiller
1) You said above that I should a) add a meta tag to my new object and b) register it with the ObjectField registry. What’s confusing me a bit, though, is that I’m not really using a new object, just the existing LinkSchema copied over from the hacker news site. All I’ve done there is just assign an instance of it to a new variable with the many flag set: links = LinkSchema(many=True). Then in the views.py, I’d imported links as links_schema, and used that to process what is returned to the client.
2) I think one thing that might be going wrong here is that I’m basically bypassing that chain we discussed yesterday (i.e. query.pagination() -> PaginationSChema -> MorphingSchema -> (target schema)). Is that right? This is perhaps why the data that’s being sent to the client is off: because it’s just the target schema essentially, and hasn’t been wrapped by the PaginationSchema? Am I on the right track?
3) So is the right thing to do here to have my view for the /links/ route return in a way that resembles what you’ve got in that /latest view? I.e. feed a query = Object.query to objects_paged.dump() imported from beavy.models.object, passing it through the as_page() method?
Looking forward to Thursday!
Benjamin Kampmann
@gnunicorn
hacker_news wasn’t completed yet. doesn’t look like I finished that part.
the basic (later) idea would be to have a bunch of listing views which are global and you only configure your LinkObject to be included in them in a specific way (via the Object-Capabilities)
you’d still very much need a Schema though.
but to answer your question, yes, you don’t use the pagination-system supplied at the moment.
I am not certain that is causing that particular bug, but I recommend staying in that chain, to get all the benefits provided.
Ethan Miller
@ezmiller
Huh. Okay. Perhaps, then, I should think of this as a merge into Beavy and work on the global solution of having listing views. The interaction between the back end and the front here is still a confusing area here where I have a lot to learn and that sounds like a good exercise.
Benjamin Kampmann
@gnunicorn
sounds good :)
Benjamin Kampmann
@gnunicorn
\o/ was able to login!
gotta do some committing!
Ethan Miller
@ezmiller
what was preventing you from logging in?
Benjamin Kampmann
@gnunicorn
my rewrite :D
beavyHQ/beavy#37
Ethan Miller
@ezmiller
AAhhh. Good idea by the way.
Benjamin Kampmann
@gnunicorn
what is?
the persona system?
Ethan Miller
@ezmiller
Yes.
Benjamin Kampmann
@gnunicorn
yeah. I strongly think so. it was one of the major shortcomings of most systems.
(like … discourse. no difference between their system-bot and any logged in person – is just awkward.)
though I am sure this will come a with a range of other complications :D
Ethan Miller
@ezmiller
what doesn’t!
Benjamin Kampmann
@gnunicorn
ahaha! yes, that's the spirit!