Git Product home page Git Product logo

Comments (8)

cdbennett avatar cdbennett commented on May 27, 2024

I think this is broken again. Tested on 0.9+ (acc1511). I have to specify %2F instead of a slash:

cbennett@AP-CBENNETT MINGW64 /c/work/python-gitlab (pu)
$ gitlab -c test.ini project get --id sandbox/msgparsedemo
Impossible to get object (Expecting value: line 1 column 1 (char 0))

cbennett@AP-CBENNETT MINGW64 /c/work/python-gitlab (pu)
$ gitlab -c test.ini project get --id sandbox%2Fmsgparsedemo
id: 34
path: msgparsedemo

cbennett@AP-CBENNETT MINGW64 /c/work/python-gitlab (pu)
$

from python-gitlab.

cdbennett avatar cdbennett commented on May 27, 2024

👍 Awesome, tested and fixed.

from python-gitlab.

derekschrock avatar derekschrock commented on May 27, 2024

Does this only apply to 'gitlab project' or 'gitlab project get' or should you not expect this same symbolic naming for other commands/subcomamnds that have a --project-id or --id? ex: 'gitlab project-commit-comment list --commit-id ... --project-id' This is still expecting a number.

If so I'd highly recommend this in every instance where a --project-id or --id that a group/project should be allowed.

If you agree would you like a issue per command or per subcommand or a large meta issue be alright?

from python-gitlab.

gpocentek avatar gpocentek commented on May 27, 2024

@derekschrock this works for project get but not for other subcommands (--project-id namespace/name doesn't work).

I'd rather have a single issue. Thanks!

from python-gitlab.

jgeorgeson avatar jgeorgeson commented on May 27, 2024

I'm able to use path%2fname for --project-id and --group-id everywhere I've tried it, including subgroup projects. Though I would greatly prefer '/' instead of '%2f'.

from python-gitlab.

derekschrock avatar derekschrock commented on May 27, 2024

Appears to be a v4 issue? Works as expected in v3.

from python-gitlab.

derekschrock avatar derekschrock commented on May 27, 2024
$ gitlab project-issue list --project-id 'issues/issues' # with v3
id: 4
title: Testing123

id: 3
title: Testing

$ gitlab project-issue list --project-id 'issues/issues' # with v4
Impossible to list objects (400: {"error":"issue_iid is invalid"})

$ gitlab project-issue list --project-id 'issues%2Fissues' # with v4
iid: 2
title: Testing123

iid: 1
title: Testing

from python-gitlab.

derekschrock avatar derekschrock commented on May 27, 2024

My 100th first try at doing python but I think this should fix it?

diff --git a/gitlab/v4/cli.py b/gitlab/v4/cli.py
index 939a7cc..fb84be3 100644
--- a/gitlab/v4/cli.py
+++ b/gitlab/v4/cli.py
@@ -42,6 +42,8 @@ class GitlabCLI(object):
         # parents, build the chain of managers to get to the final object.
         # Instead we do something ugly and efficient: interpolate variables in
         # the class _path attribute, and replace the value with the result.
+        if 'project_id' in self.args:
+            self.args['project_id'] = self.args['project_id'].replace('/', '%2F')
         self.mgr_cls._path = self.mgr_cls._path % self.args
         self.mgr = self.mgr_cls(gl)

from python-gitlab.

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.