Giter Club home page Giter Club logo

Comments (9)

rimshaakhan avatar rimshaakhan commented on July 26, 2024

Hi, I am new and would like to work on this one.

What I think is that the function here needs to be changed:

def due(self):
    """
    Returns the due date, as a datetime object, if set, or None.
    """
    if self.todo.get('due', None) is None:
        return None
    else:
        return self._normalize_datetime(self.todo.decoded('due'))

Am I thinking right?
Also, if yes the what data type should be returned>

from todoman.

WhyNotHugo avatar WhyNotHugo commented on July 26, 2024

Hi, thanks for you interest in todoman!

Sorry but no, that's not the actual place change it. The value returned here is used in a few other places that would break:

  • Printing with the --porcelain flag, which uses a different time format.
  • Comparing the date of two todos. (comparing strings like "today", "yesterday" and 2017-03-20 doesn't give the expected results).

As a general rule, the Todo class returns data in machine-friendly types (eg: datetime, etc) and will be sent back and forth.
The TodoFormatter class converts Todos into something friendly to humans/users and is what you're looking for. Specifically, the format_date function does this bit (this one does return a string).

from todoman.

rimshaakhan avatar rimshaakhan commented on July 26, 2024

Oh! I get it now and am likely to send a PR by "tomorrow" :)

from todoman.

WhyNotHugo avatar WhyNotHugo commented on July 26, 2024

Thanks! Let me know if you have any questions, though in out of town right now and replies might be a little sparse.

from todoman.

rimshaakhan avatar rimshaakhan commented on July 26, 2024

Hi @hobarrera

I am having some trouble with todoman:

I have installed all the required packages, configuration file is in place, but everytime I type todo: A error throws up:

Traceback (most recent call last):
  File "/home/im_ishan/Desktop/todoman/todoman_env/bin/todo", line 11, in <module>
    sys.exit(cli())
  File "/home/im_ishan/Desktop/todoman/todoman_env/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/im_ishan/Desktop/todoman/todoman_env/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/im_ishan/Desktop/todoman/todoman_env/lib/python3.5/site-packages/click/core.py", line 1043, in invoke
    return Command.invoke(self, ctx)
  File "/home/im_ishan/Desktop/todoman/todoman_env/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/im_ishan/Desktop/todoman/todoman_env/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/im_ishan/Desktop/todoman/todoman_env/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/im_ishan/Desktop/todoman/todoman_env/lib/python3.5/site-packages/todoman/cli.py", line 117, in cli
    ctx.obj['db'] = Database(paths, cache_path)
  File "/home/im_ishan/Desktop/todoman/todoman_env/lib/python3.5/site-packages/todoman/model.py", line 696, in __init__
    self.cache = Cache(cache_path)
  File "/home/im_ishan/Desktop/todoman/todoman_env/lib/python3.5/site-packages/todoman/model.py", line 366, in __init__
    self.conn = sqlite3.connect(self.cache_path)
sqlite3.OperationalError: unable to open database file

Do I need to create the sqlite database manually or am I doing something wrong?

Thank you in advance

from todoman.

untitaker avatar untitaker commented on July 26, 2024

Hello @rimshaakhan, that really shouldn't happen. Could you post the output of echo $XDG_CACHE_DIR on your console and also post your configuration file?

from todoman.

untitaker avatar untitaker commented on July 26, 2024

Ah I see, you are using the released version of todoman. We really should make a new release, but for development I recommend cloning the todoman repository, cd-ing to it, then running this inside of your virtualenv:

pip install -e .

If you change the code in the git repository, you can see the changes immediately without having to reinstall todoman.

from todoman.

rimshaakhan avatar rimshaakhan commented on July 26, 2024

Oh Yeah! That worked

Thanks @untitaker

from todoman.

untitaker avatar untitaker commented on July 26, 2024

I use exact datetimes in my due dates (and a custom format string in my config), so introducing this will break my workflow because it will obscure the exact time if my event is happening today or tomorrow. See #109

from todoman.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.