Re: Some questions about file handling + some other things
Nagy Gabor <[email protected]>
| Newsgroups | gmane.comp.bug-tracking.roundup.user |
|---|---|
| Message-ID | <20210325024931.57054746@Dell> |
Dear Ralf,
> On Wed, Mar 24, 2021 at 12:55:12AM +0100, Nagy Gabor wrote:
> > One more question on Dates. The dates must be submitted in
> > html form variables in the standard date format 2021-03-24.14:00,
> > right? There are methods for printing dates in alternative format
> > (like pretty()), but it seems to me that the date submitted to
> > Roundup must be in this format. And I guess if my users want a
> > different date format, then I have to do the conversions on my own.
> >
>
> You can also enter dates in the extended format that allows for
> arithmetics on dates, e.g.
>
> .
> .+5w
> .-3y
>
> would all be valid dates to enter in the date field.
Yes, I keep in mind, that if I do any date conversions as John
suggested, then I should not break the arithmetics or '.' etc.
> > And some additional comments I've run into this weekend:
> >
> > The sorted method of Multilink properties (provided by the cgi
> > engine), does not always work as expected. First, I got Python
> > error on context.files.sorted('filetype'), when the 'files' list
> > had an item with 'filetype' unset.
>
> Sorting by Multilink happens in Python not in SQL. What is your
> use-case for sorting by Multilink? In my experience the sort order
> created by this is hardly understandable by humans.
From John's email I realised that 'filetype' was not the correct
example here. (As you probably noticed, my English is far from perfect.)
I did not mean mime-type (which is called 'type' in Roundup), but
something like category of files (like "copy of diploma", for example),
and in my real tracker it is context.documents.sorted('...').
I wanted to use this to group the files (=documents) of a task item
by their 'filetype' (=category), similarly to a Class' index view: First
list documents with type "copy of diploma", then ... And since
'filetype' is a user-editable (sorted) list, I do not want to hard-code
it to my html template.
> I would like to deprecate its use.
I am fine with that, too. As I said in my reply to John's email, it can
be easily replaced by Python's sorted() function (by accessing _value).
> > Second, this method does not seem to respect the data type of the
> > 'order' property of 'filetype' class.
>
> This is definitely worth a bug-report, especially if this also applies
> to sorting by non-multilinks.
> I *think* we currently allow only strings as key- order- and label
> properties. This should probably change.
If this is the case, then I should quickly modify my schema.py soon,
because my schema.py is full of order=Integer(). :) So I am happy that
I brought this up.
> I also at one time wanted to implement key properties with multiple
> values: An application often demands uniqueness over several
> properties not just one. I discussed this *many* years ago with
> Richard but he feared at the time that things would be complicated by
> this. I still think it would be a useful feature.
>
> > It was set to Integer in my
> > schema.py for the 'filetype' class, but sorted() treated it as a
> > string. It took a while until I realised that the reason for
> > unexpected sorting is "12" < "2", for example. :)
> Ouch :-)
>
> > Finally, one more minor question. Assume that I want to sort
> > notclosed tasks by 'deadline' in increasing order (which seems
> > reasonable). In this case the first tasks will be those for which
> > deadline is unset.
>
> Yes, this happened more-or-less accidentally: It is the default order
> of mysql and was correctly covered by the regression tests, so
> sorting them in front is explicitly done in the generated sql for
> other backends.
>
> > But what if I want to put them to the end of the list? How this can
> > be done?
>
> You currently cannot change the way things are sorted (Except for the
> sort direction).
>
> > (First try: I won't allow unset deadline, it is 9999-12-31 behind
> > the scenes.
>
> Yes, this is a sensible choice if your application allows it.
> You can code an auditor that sets the date to some default value if
> the user didn't supply one.
>
> > Second try: I do two database query for tasks (the first
> > one filters on 'deadline is set', and an other one filters on
> > 'deadline is not set', and join these list.
>
> Yes, this can be done in an explicit index template if you really need
> that behavior.
>
> > But this is just an example, I am more interested in how these
> > filter/sort cgi request can be customized, or the obtained "batch
> > list" modified?)
>
> Currently you cannot customize how individual properties that are
> included in sort and/or group are sorted, except for reverse/forward.
>
> Ralf
OK. Thank you.
Regards,
Gábor
_______________________________________________
Roundup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/roundup-users